From 7b26e337fd0ff35e35b7c92af2245ff9f4716172 Mon Sep 17 00:00:00 2001 From: Denis Roussel Date: Thu, 24 Oct 2024 12:42:19 +0200 Subject: [PATCH] [IMP] sale_invoice_policy: Don't reuse fields in depends As ORM appends new depends() parameters to existing ones, simplify the writing --- sale_invoice_policy/models/sale_order_line.py | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/sale_invoice_policy/models/sale_order_line.py b/sale_invoice_policy/models/sale_order_line.py index 1eb370f879d..7c3d57ca025 100644 --- a/sale_invoice_policy/models/sale_order_line.py +++ b/sale_invoice_policy/models/sale_order_line.py @@ -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 @@ -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"