2
0

[16.0][FIX] account_spread_cost_revenue, invalid reconcile when invoice_line_ids > 1

This commit is contained in:
Kitti U 2024-03-11 15:18:27 +07:00
parent b3dad43c85
commit c0d7496bf9

View File

@ -176,7 +176,7 @@ class AccountSpread(models.Model):
def _compute_invoice_line(self): def _compute_invoice_line(self):
for spread in self: for spread in self:
invoice_lines = spread.invoice_line_ids invoice_lines = spread.invoice_line_ids
spread.invoice_line_id = invoice_lines and invoice_lines[0] or False spread.invoice_line_id = invoice_lines and invoice_lines[-1:] or False
def _inverse_invoice_line(self): def _inverse_invoice_line(self):
for spread in self: for spread in self:
@ -573,7 +573,7 @@ class AccountSpread(models.Model):
mls_to_reconcile = spread_mls.filtered(lambda l: l.account_id == account) mls_to_reconcile = spread_mls.filtered(lambda l: l.account_id == account)
if mls_to_reconcile: if mls_to_reconcile:
do_reconcile = mls_to_reconcile + self.invoice_line_id do_reconcile = mls_to_reconcile + self.invoice_line_ids
do_reconcile.remove_move_reconcile() do_reconcile.remove_move_reconcile()
for line in do_reconcile: for line in do_reconcile:
line.reconciled = False line.reconciled = False