FixHighlight of Weekly #002

Consolidated credit notes linked to their invoice

Credit notes with lines from several sales orders never got reversed_entry_id. Localizations such as TicketBAI need that link to report the refund.

Versions18.019.020.0
ModulesInvoicing account
AppAccounting

Pull requests and commits

BranchPull requestCommit
18.0odoo/odoo#288320 ↗9b6aa32f4d ↗
19.0odoo/odoo#291159 ↗7e6b005958 ↗
20.0odoo/odoo#291215 ↗86707bc0a6 ↗

Commit message

[FIX] account: link credit note to consolidated source invoice

When a credit note (out_refund) consolidates sale lines coming from
several orders, _set_reversed_entry fails to set reversed_entry_id. The
check 'credit_note.invoice_line_ids.sale_line_ids in
inv.invoice_line_ids.sale_line_ids' relies on recordset.__contains__,
which requires the left operand to be a singleton and otherwise returns
False. As a result reversed_entry_id is never set when the credit note
carries lines from more than one order, even though it reverses a single
consolidated invoice.

Localizations such as TicketBAI rely on reversed_entry_id to build the
refunded document reference and reject the refund otherwise with
"Cannot post a reversal document while the source document has not been
posted".

Use the <= subset operator instead, which behaves correctly for singleton
and multi-record sets alike.

MT-15939

My stack

Pick the versions and apps you run. Weekly digests, this week's table and All changes then show only what concerns you. Saved in this browser.

Versions
Apps
Modules