From 8bedb814cfa2030cfe1946ff108270c0afcfa2b3 Mon Sep 17 00:00:00 2001 From: Jordi Ballester Date: Wed, 2 Mar 2022 11:35:08 +0100 Subject: [PATCH] [IMP] rma: Refactor all rma modules in order to consider using the correct price unit in moves Otherwise the inventory accounting will be completely wrong. --- rma/models/stock_rule.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rma/models/stock_rule.py b/rma/models/stock_rule.py index bf1340da..a3da529f 100644 --- a/rma/models/stock_rule.py +++ b/rma/models/stock_rule.py @@ -35,7 +35,8 @@ class StockRule(models.Model): res["partner_id"] = line.delivery_address_id.id else: res["partner_id"] = line.rma_id.partner_id.id - dest_loc = self.env["stock.location"].browse([res["location_dest_id"]])[0] - if dest_loc.usage == "internal": - res["price_unit"] = line.price_unit + company_id = res["company_id"] + company = self.env["res.company"].browse(company_id) + cost = product_id.with_company(company).standard_price + res["price_unit"] = cost return res