From 14b59034ada752b3562c059a1a41f101b0443699 Mon Sep 17 00:00:00 2001 From: Martin Quinteros Date: Thu, 20 Feb 2025 09:33:07 -0300 Subject: [PATCH] [FIX] stock_currency_valuation: Fix price unit when pruchase price is zero --- stock_currency_valuation/models/stock_move.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stock_currency_valuation/models/stock_move.py b/stock_currency_valuation/models/stock_move.py index 3ebf3d6b5..bab1e2546 100644 --- a/stock_currency_valuation/models/stock_move.py +++ b/stock_currency_valuation/models/stock_move.py @@ -13,6 +13,8 @@ def _get_price_unit(self): self.ensure_one() price_unit = super()._get_price_unit() precision = self.env['decimal.precision'].precision_get('Product Price') + if float_is_zero(price_unit, precision): + return price_unit if self.picking_id.currency_rate and self.purchase_line_id.order_id.currency_id == self.picking_id.valuation_currency_id: price_unit = self.purchase_line_id.price_unit / self.picking_id.currency_rate return price_unit if not float_is_zero(price_unit, precision) or self._should_force_price_unit() else self.product_id.standard_price