From 5a9cb644147ee891e1afb3ddf88e052cdda7fb04 Mon Sep 17 00:00:00 2001 From: Joseph Caburnay Date: Fri, 20 Sep 2019 08:21:54 +0000 Subject: [PATCH] [FIX] delivery: wrong delivery price for real cost policy When real cost invoice policy is active in a delivery carrier, the delivery price is set after validating the delivery. When there is margin, the estimated price is calculated with margin but when the delivery is validated, the price set in the delivery line does not include the margin. This commit fixes this behavior by setting the price of the delivery line with appropriate margin. closes odoo/odoo#37178 Signed-off-by: pimodoo --- addons/delivery/models/stock_picking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/delivery/models/stock_picking.py b/addons/delivery/models/stock_picking.py index 9b46344a9b1..9b15974a938 100644 --- a/addons/delivery/models/stock_picking.py +++ b/addons/delivery/models/stock_picking.py @@ -153,7 +153,7 @@ class StockPicking(models.Model): res = self.carrier_id.send_shipping(self)[0] if self.carrier_id.free_over and self.sale_id and self.sale_id._compute_amount_total_without_delivery() >= self.carrier_id.amount: res['exact_price'] = 0.0 - self.carrier_price = res['exact_price'] + self.carrier_price = res['exact_price'] * (1.0 + (self.carrier_id.margin / 100.0)) if res['tracking_number']: self.carrier_tracking_ref = res['tracking_number'] order_currency = self.sale_id.currency_id or self.company_id.currency_id