Skip to content

Commit

Permalink
[IMP] sale_invoice_policy: Don't reuse fields in depends
Browse files Browse the repository at this point in the history
As ORM appends new depends() parameters to existing ones, simplify the writing
  • Loading branch information
rousseldenis committed Oct 24, 2024
1 parent a05ed41 commit 7b26e33
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions sale_invoice_policy/models/sale_order_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,7 @@
class SaleOrderLine(models.Model):
_inherit = "sale.order.line"

@api.depends(
"qty_invoiced",
"qty_delivered",
"product_uom_qty",
"state",
"order_id.invoice_policy",
)
@api.depends("order_id.invoice_policy")
def _compute_qty_to_invoice(self):
"""
Exclude lines that have their order invoice policy filled in
Expand All @@ -30,15 +24,7 @@ def _compute_qty_to_invoice(self):
line.qty_to_invoice = line.qty_delivered - line.qty_invoiced
return True

@api.depends(
"state",
"price_reduce",
"product_id",
"untaxed_amount_invoiced",
"qty_delivered",
"product_uom_qty",
"order_id.invoice_policy",
)
@api.depends("order_id.invoice_policy")
def _compute_untaxed_amount_to_invoice(self):
other_lines = self.filtered(
lambda line: line.product_id.type == "service"
Expand Down

0 comments on commit 7b26e33

Please sign in to comment.