diff --git a/addons/account_edi_ubl_cii/i18n/account_edi_ubl_cii.pot b/addons/account_edi_ubl_cii/i18n/account_edi_ubl_cii.pot index 1cd4d6d075b..26724fbed85 100644 --- a/addons/account_edi_ubl_cii/i18n/account_edi_ubl_cii.pot +++ b/addons/account_edi_ubl_cii/i18n/account_edi_ubl_cii.pot @@ -837,6 +837,15 @@ msgid "" "The field 'Sanitized Account Number' is required on the Recipient Bank." msgstr "" +#. module: account_edi_ubl_cii +#. odoo-python +#: code:addons/account_edi_ubl_cii/models/account_edi_xml_ubl_bis3.py:0 +#, python-format +msgid "" +"The invoice contains line(s) with a negative unit price, which is not " +"allowed. You might need to set a negative quantity instead." +msgstr "" + #. module: account_edi_ubl_cii #. odoo-python #: code:addons/account_edi_ubl_cii/models/account_edi_xml_cii_facturx.py:0 diff --git a/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_bis3.py b/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_bis3.py index 4bce8d3248a..3ebd7ba6a9f 100644 --- a/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_bis3.py +++ b/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_bis3.py @@ -306,6 +306,11 @@ class AccountEdiXmlUBLBIS3(models.AbstractModel): } for line in invoice.invoice_line_ids.filtered(lambda x: x.display_type not in ('line_note', 'line_section')): + if invoice.currency_id.compare_amounts(line.price_unit, 0) == -1: + # [BR-27]-The Item net price (BT-146) shall NOT be negative. + constraints.update({'cen_en16931_positive_item_net_price': _( + "The invoice contains line(s) with a negative unit price, which is not allowed." + " You might need to set a negative quantity instead.")}) if len(line.tax_ids.flatten_taxes_hierarchy().filtered(lambda t: t.amount_type != 'fixed')) != 1: # [UBL-SR-48]-Invoice lines shall have one and only one classified tax category. # /!\ exception: possible to have any number of ecotaxes (fixed tax) with a regular percentage tax