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 65c47d8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions sale_force_invoiced/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import sale_order
from . import sale_order_line
15 changes: 15 additions & 0 deletions sale_force_invoiced/models/sale_order_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2017 ForgeFlow S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import api, fields, models


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 65c47d8

Please sign in to comment.