odoo/odoo#208069
Created by fw-bot
Merged
at e4bd46930d1841fcd50bf426f5625e9495213ef7
Statuses:
- legal/cla: Contributor License Agreement check
- ci/runbot: Odoo Test Suite
- ci/upgrade_enterprise: Test upgrades for enterprise master
- ci/template: Contact runbot team on discord for help.
- ci/style: Optional style check. Ignore it only if strictly necessary.
- ci/security: Required security check. Can only be ignored by security team.
- ci/l10n: (runtime 0s)
- label
- odoo-dev:17.0-16.0-l10n_sa_edi-fix-zatca-posting-with-reversed-downpayment-loug-422160-fw
- head
- 6e7af44f3c76c4eae98a35bbf0bf9ff06185891f
- merged
- 2 months ago by Training, Louis Gobert (loug)
odoo/odoo | |
---|---|
16.0 | #201322 |
17.0 | #208069 |
saas-17.4 | #208259 |
18.0 | #208325 |
saas-18.1 | #208333 |
saas-18.2 | #209391 |
saas-18.3 | #209394 |
master | #209398 |
[FW][FIX] l10n_sa_edi: fix ZATCA posting with reversed downpayment
An error occurs when trying to send a reversed invoice to ZATCA if it included a downpayment that was also reversed.
Steps to reproduce:
- Install "Sales" and "Saudi Arabia - E-invoicing" apps.
- Create a quotation and confirm it.
- Create a downpayment and post it to ZATCA.
- Create an invoice A including the downpayment and post it.
- Reverse the downpayment and post it to ZATCA.
- Reverse invoice A and try posting it to ZATCA.
An error will occur:
File ".../l10n_sa_edi/models/account_edi_xml_ubl_21_zatca.py", line 356, in _l10n_sa_get_line_prepayment_vals
'prepayment_id': prepayment_move_id.name,
^^^^^^^^^^^^^^^^^^^^^^^
File ".../odoo/fields.py", line 1154, in __get__
record.ensure_one()
File ".../odoo/models.py", line 5204, in ensure_one
raise ValueError("Expected singleton: %s" % self)
ValueError: Expected singleton: account.move(190098, 190096)
This fix ensures that only the actual downpayment move is used by filtering on the move type.
Forward-Port-Of: #201322