[IMP] account_edi_ubl_cii: prevent negative unit prices for bis 3
The unit prices should always be positives in the Peppol Bis 3 xml, otherwise, a validator will raise "[BR-27]-The Item net price (BT-146) shall NOT be negative.". Add a constraint in the code to ensure this. task-3607341 closes odoo/odoo#143648 X-original-commit: db52055f72ce5d9b1667ee89c55301756a0fabab Signed-off-by: Laurent Smet (las) <las@odoo.com> Signed-off-by: Julien Van Roy (juvr) <juvr@odoo.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user