From 73a36fa6248652afae034b0e8290f9f940b0b063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Scarafia?= Date: Mon, 15 Dec 2025 20:49:39 +0000 Subject: [PATCH 1/2] [FIX] _cost_sale_margin:: do not recompute on rep cost change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit el depnds este era terrible a nivel performance (traslada todos los depends de rep cost) y además funcionalmente no es deseado, cambios en costo (por cualquier motivo), no deberían recomputar los costos existentes X-original-commit: a2442ca3002988bfbe46d6916d9abfffb190bb43 --- .../models/sale_order_line.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/product_replenishment_cost_sale_margin/models/sale_order_line.py b/product_replenishment_cost_sale_margin/models/sale_order_line.py index 1addaed76..2a3a1e8d8 100644 --- a/product_replenishment_cost_sale_margin/models/sale_order_line.py +++ b/product_replenishment_cost_sale_margin/models/sale_order_line.py @@ -4,7 +4,6 @@ class SaleOrderLine(models.Model): _inherit = 'sale.order.line' - @api.depends('product_id.replenishment_cost') def _compute_purchase_price(self): super()._compute_purchase_price() for line in self.filtered('product_id'): @@ -20,7 +19,6 @@ def _compute_purchase_price(self): line.purchase_price = frm_cur._convert( purchase_price, to_cur, order_id.company_id or self.env.company, order_id.date_order or fields.Date.today(), round=False) - def _convert_price(self, product_cost, from_uom): if not product_cost: From b265ee64e50506133d6a759377bae2053ef07505 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Scarafia?= Date: Mon, 15 Dec 2025 20:53:03 +0000 Subject: [PATCH 2/2] [IMP] _rep_cost: less depends, better performance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dejamos depends igual que como tenemos en 18+ ver acá https://github.com/ingadhoc/product/commit/499693f22106ed1184f341ec0e2dd47e3a6850a6 X-original-commit: 62f205b6a9b87eaa2ff29fff925678d1a419a098 --- product_replenishment_cost/models/product_template.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/product_replenishment_cost/models/product_template.py b/product_replenishment_cost/models/product_template.py index df6a86331..e833bcaa4 100644 --- a/product_replenishment_cost/models/product_template.py +++ b/product_replenishment_cost/models/product_template.py @@ -188,13 +188,11 @@ def _compute_replenishment_cost_last_update(self): # rule # 'replenishment_base_cost_currency_id', # # because of being stored - 'replenishment_base_cost_currency_id.rate_ids.rate', + 'replenishment_base_cost_currency_id', # # and this if we change de date (name field) # 'replenishment_base_cost_currency_id.rate_ids.name', # rule items - 'replenishment_cost_rule_id.item_ids.sequence', - 'replenishment_cost_rule_id.item_ids.percentage_amount', - 'replenishment_cost_rule_id.item_ids.fixed_amount', + 'replenishment_cost_rule_id', ) @api.depends_context('company') def _compute_replenishment_cost(self):