-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[16.0][IMP] sale_force_invoiced: update untaxed_amount_to_invoice
Recompute untaxed_amount_to_invoice on the sale order lines when force_invoiced is changed.
- Loading branch information
1 parent
d5465a3
commit 65c47d8
Showing
2 changed files
with
16 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |