Skip to content

Commit 12b97ea

Browse files
author
Andrii Kompaniiets
committed
[FIX] l10n_es_vat_prorate: Check that bill with prorate has prorate lines
MT-13468
1 parent a1afcd8 commit 12b97ea

File tree

4 files changed

+97
-26
lines changed

4 files changed

+97
-26
lines changed

l10n_es_vat_prorate/i18n/es.po

Lines changed: 51 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ msgid ""
66
msgstr ""
77
"Project-Id-Version: Odoo Server 16.0\n"
88
"Report-Msgid-Bugs-To: \n"
9-
"POT-Creation-Date: \n"
10-
"PO-Revision-Date: 2025-07-16 18:22+0200\n"
11-
"Last-Translator: Pedro M. Baeza <pedro.baeza@tecnativa.com>\n"
9+
"POT-Creation-Date: 2026-01-28 09:36+0000\n"
10+
"PO-Revision-Date: 2026-01-28 10:37+0100\n"
11+
"Last-Translator: Andrii Kompaniiets <andrii@moduon.team>\n"
1212
"Language-Team: none\n"
1313
"Language: es\n"
1414
"MIME-Version: 1.0\n"
@@ -69,17 +69,27 @@ msgstr "ID (identificación)"
6969

7070
#. module: l10n_es_vat_prorate
7171
#: model:ir.model.fields,help:l10n_es_vat_prorate.field_res_company_vat_prorate__special_vat_prorate_default
72+
#, fuzzy
73+
#| msgid ""
74+
#| "If the Special VAT Prorate is enabled, this value indicates whether all "
75+
#| "the invoice lines will be prorated by default"
7276
msgid ""
7377
"If the Special VAT Prorate is enabled, this value indicates whether all the "
74-
"invoice lines will be prorated by default"
78+
"invoice lines will be prorated by default. On the other hand, all the "
79+
"invoice lines will be not prorated by default."
7580
msgstr ""
7681
"Si la prorrata especial de IVA esta establecida, este valor indica si todas "
7782
"las líneas de factura serán prorrateadas por defecto"
7883

7984
#. module: l10n_es_vat_prorate
8085
#: model:ir.model.fields,help:l10n_es_vat_prorate.field_res_company_vat_prorate__type
86+
#, fuzzy
87+
#| msgid ""
88+
#| "If the special prorate is enabled, you will be able to select which "
89+
#| "invoice lines will be prorated."
8190
msgid ""
82-
"If the special prorate is enabled, you will be able to select which invoice "
91+
"If the general prorate is enabled, all invoice lines will be prorated. If "
92+
"the special prorate is enabled, you will be able to select which invoice "
8393
"lines will be prorated."
8494
msgstr ""
8595
"Si la prorrata especial esta establecida, podrás seleccionar que lineas de "
@@ -121,7 +131,6 @@ msgstr "Última Actualización el"
121131
#. module: l10n_es_vat_prorate
122132
#: model:ir.model.fields,field_description:l10n_es_vat_prorate.field_account_bank_statement_line__prorate_id
123133
#: model:ir.model.fields,field_description:l10n_es_vat_prorate.field_account_move__prorate_id
124-
#: model:ir.model.fields,field_description:l10n_es_vat_prorate.field_account_payment__prorate_id
125134
msgid "Prorate"
126135
msgstr "Prorrata"
127136

@@ -130,6 +139,13 @@ msgstr "Prorrata"
130139
msgid "Prorate Account"
131140
msgstr "Cuenta prorrateada"
132141

142+
#. module: l10n_es_vat_prorate
143+
#: model:ir.model.fields,field_description:l10n_es_vat_prorate.field_account_move_line__prorate_line_ids
144+
#, fuzzy
145+
#| msgid "Prorate"
146+
msgid "Prorate Line"
147+
msgstr "Prorrata"
148+
133149
#. module: l10n_es_vat_prorate
134150
#: model:ir.model.fields.selection,name:l10n_es_vat_prorate.selection__res_company_vat_prorate__type__special
135151
msgid "Special"
@@ -145,16 +161,21 @@ msgstr "Prorrata especial de IVA por defecto"
145161
msgid "Tax"
146162
msgstr "Impuesto"
147163

164+
#. module: l10n_es_vat_prorate
165+
#. odoo-python
166+
#: code:addons/l10n_es_vat_prorate/models/account_move.py:0
167+
msgid ""
168+
"The invoice [ID %(invoice_id)s] cannot be posted. It is necessary to verify "
169+
"that the VAT prorate has been applied correctly."
170+
msgstr ""
171+
"No se puede confirmar la factura [ID %(invoice_id)s] es necesario comprobar "
172+
"que la prorrata del IVA se ha aplicado correctamente."
173+
148174
#. module: l10n_es_vat_prorate
149175
#: model:ir.model.fields,help:l10n_es_vat_prorate.field_account_move_line__vat_prorate
150176
msgid "The line is a vat prorate"
151177
msgstr "La línea es una prorrata de IVA"
152178

153-
#. module: l10n_es_vat_prorate
154-
#: model:ir.model.fields,help:l10n_es_vat_prorate.field_account_move_line__with_vat_prorate
155-
msgid "The line will create a vat prorate"
156-
msgstr "La línea creará una prorrata de IVA"
157-
158179
#. module: l10n_es_vat_prorate
159180
#: model:ir.model.fields,field_description:l10n_es_vat_prorate.field_res_company_vat_prorate__type
160181
msgid "Type"
@@ -172,44 +193,49 @@ msgstr "Tabla de prorrateo del IVA"
172193

173194
#. module: l10n_es_vat_prorate
174195
#: model:ir.model.constraint,message:l10n_es_vat_prorate.constraint_res_company_vat_prorate_vat_prorate_percent_amount
175-
msgid "VAT prorate must be between 0.01 and 100!"
196+
#, fuzzy
197+
#| msgid "VAT prorate must be between 0.01 and 100!"
198+
msgid "VAT prorate must be between 0.01 and 99.9!"
176199
msgstr "¡La prorrata del IVA debe estar comprendida entre 0,01 y 100!"
177200

178-
#. module: l10n_es_vat_prorate
179-
#: model_terms:ir.ui.view,arch_db:l10n_es_vat_prorate.account_move_form_view
180-
msgid "VAT prorate?"
181-
msgstr "¿Prorrata IVA?"
182-
183201
#. module: l10n_es_vat_prorate
184202
#: model:ir.model.fields,field_description:l10n_es_vat_prorate.field_res_company__vat_prorate_ids
185203
#: model:ir.model.fields,field_description:l10n_es_vat_prorate.field_res_company_vat_prorate__vat_prorate
204+
#: model_terms:ir.ui.view,arch_db:l10n_es_vat_prorate.account_move_form_view
186205
msgid "Vat Prorate"
187206
msgstr "Prorrata del IVA"
188207

189208
#. module: l10n_es_vat_prorate
190209
#: model:ir.model.fields,field_description:l10n_es_vat_prorate.field_account_bank_statement_line__with_special_vat_prorate
191210
#: model:ir.model.fields,field_description:l10n_es_vat_prorate.field_account_move__with_special_vat_prorate
192-
#: model:ir.model.fields,field_description:l10n_es_vat_prorate.field_account_payment__with_special_vat_prorate
193211
msgid "With Special Vat Prorate"
194212
msgstr "Con prorrata especial de IVA"
195213

196214
#. module: l10n_es_vat_prorate
197-
#: model:ir.model.fields,field_description:l10n_es_vat_prorate.field_account_move_line__with_vat_prorate
198215
#: model:ir.model.fields,field_description:l10n_es_vat_prorate.field_account_tax__with_vat_prorate
199216
#: model:ir.model.fields,field_description:l10n_es_vat_prorate.field_res_company__with_vat_prorate
200217
msgid "With VAT Prorate"
201218
msgstr "Con prorrata de IVA"
202219

203220
#. module: l10n_es_vat_prorate
204-
#. odoo-python
205-
#: code:addons/l10n_es_vat_prorate/models/res_company.py:0
206-
#, python-format
207-
msgid "You can't have a special VAT prorrate of 100%"
208-
msgstr "No puede tener una prorrata especial de IVA del 100%"
221+
#: model:ir.model.fields,field_description:l10n_es_vat_prorate.field_account_move_line__with_vat_prorate
222+
#, fuzzy
223+
#| msgid "With VAT Prorate"
224+
msgid "With Vat Prorate"
225+
msgstr "Con prorrata de IVA"
209226

210227
#. module: l10n_es_vat_prorate
211228
#. odoo-python
212229
#: code:addons/l10n_es_vat_prorate/models/res_company.py:0
213-
#, python-format
214230
msgid "You must complete VAT prorate information"
215231
msgstr "Debe cumplimentar la información sobre el prorrateo del IVA"
232+
233+
#~ msgid "The line will create a vat prorate"
234+
#~ msgstr "La línea creará una prorrata de IVA"
235+
236+
#~ msgid "VAT prorate?"
237+
#~ msgstr "¿Prorrata IVA?"
238+
239+
#, python-format
240+
#~ msgid "You can't have a special VAT prorrate of 100%"
241+
#~ msgstr "No puede tener una prorrata especial de IVA del 100%"

l10n_es_vat_prorate/i18n/l10n_es_vat_prorate.pot

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
#
55
msgid ""
66
msgstr ""
7-
"Project-Id-Version: Odoo Server 18.0\n"
7+
"Project-Id-Version: Odoo Server 18.0+e\n"
88
"Report-Msgid-Bugs-To: \n"
9+
"POT-Creation-Date: 2026-01-28 09:36+0000\n"
10+
"PO-Revision-Date: 2026-01-28 09:36+0000\n"
911
"Last-Translator: \n"
1012
"Language-Team: \n"
1113
"MIME-Version: 1.0\n"
@@ -141,6 +143,14 @@ msgstr ""
141143
msgid "Tax"
142144
msgstr ""
143145

146+
#. module: l10n_es_vat_prorate
147+
#. odoo-python
148+
#: code:addons/l10n_es_vat_prorate/models/account_move.py:0
149+
msgid ""
150+
"The invoice [ID %(invoice_id)s] cannot be posted. It is necessary to verify "
151+
"that the VAT prorate has been applied correctly."
152+
msgstr ""
153+
144154
#. module: l10n_es_vat_prorate
145155
#: model:ir.model.fields,help:l10n_es_vat_prorate.field_account_move_line__vat_prorate
146156
msgid "The line is a vat prorate"

l10n_es_vat_prorate/models/account_move.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55

66
from odoo import api, fields, models
7+
from odoo.exceptions import ValidationError
78
from odoo.tools import float_round
89

910

@@ -255,6 +256,39 @@ def write(self, vals):
255256
move._apply_vat_prorate()
256257
return res
257258

259+
def _check_prorate_applied(self):
260+
self.ensure_one()
261+
if (
262+
self.company_id.with_vat_prorate
263+
and self.prorate_id
264+
and self.prorate_id.type == "general"
265+
and any(
266+
[
267+
invoice_line.with_vat_prorate
268+
for invoice_line in self.invoice_line_ids
269+
]
270+
)
271+
and any(self.invoice_line_ids.tax_ids.mapped("with_vat_prorate"))
272+
and not [line for line in self.line_ids if line.vat_prorate]
273+
):
274+
return False
275+
return True
276+
277+
def _post(self, soft):
278+
for invoice in self.filtered_domain(
279+
[("move_type", "in", ["in_invoice", "in_refund"])]
280+
):
281+
if not invoice._check_prorate_applied():
282+
raise ValidationError(
283+
self.env._(
284+
"The invoice [ID %(invoice_id)s] cannot be posted. "
285+
"It is necessary to verify that the VAT prorate "
286+
"has been applied correctly.",
287+
invoice_id=invoice.id,
288+
)
289+
)
290+
return super()._post(soft)
291+
258292

259293
class AccountMoveLine(models.Model):
260294
_inherit = "account.move.line"

l10n_es_vat_prorate/views/account_move_views.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<field
2525
name="with_vat_prorate"
2626
string="Vat Prorate"
27+
readonly="not parent.with_special_vat_prorate or parent.move_type not in ['in_invoice', 'in_refund']"
2728
column_invisible="not parent.with_special_vat_prorate or parent.move_type not in ['in_invoice', 'in_refund']"
2829
/>
2930
</xpath>

0 commit comments

Comments
 (0)