Skip to content

Commit

Permalink
[16.0][IMP] sale_force_invoiced: update untaxed_amount_to_invoice
Browse files Browse the repository at this point in the history
Recompute untaxed_amount_to_invoice on the sale order lines when force_invoiced is changed.
  • Loading branch information
alessandro-fiorino committed Apr 26, 2024
1 parent d5465a3 commit 431d427
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions sale_force_invoiced/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,14 @@ def _compute_invoice_status(self):
lambda so: so.force_invoiced and so.state in ("sale", "done")
).update({"invoice_status": "invoiced"})
return res


class SaleOrderLine(models.Model):
_inherit = "sale.order.line"

@api.depends("order_id.force_invoiced")
def _compute_untaxed_amount_to_invoice(self):
force_invoiced = self.filtered(lambda x: x.order_id.force_invoiced)
force_invoiced.update({"untaxed_amount_to_invoice": 0.0})
not_forced = self - force_invoiced
return super(SaleOrderLine, not_forced)._compute_untaxed_amount_to_invoice()

0 comments on commit 431d427

Please sign in to comment.