Skip to content
Browse files

[FIX] delivery: Delivery Order Adding Freight Cost W/O Markup

Steps to reproduce the bug:

- Let's consider a delivery method DM with fixed price of 10€ and a margin of 20%
- Let's consider a storable product P
- Create a SO for P and get the rate (12€) but don't add it on the SO
- Confirm the SO and process the delivery


A SO line was created for the freight cost without the margin. So it was 10€
instead of 12€.


closes #43206

X-original-commit: f6ce45f
Signed-off-by: Simon Goffin (sig) <>
  • Loading branch information
simongoffin committed Jan 9, 2020
1 parent b3c1411 commit 621dac802ddddc3a4dd58f7370250386e1031598
Showing with 3 additions and 2 deletions.
  1. +3 −2 addons/delivery/models/
@@ -170,12 +170,13 @@ def _add_delivery_cost_to_so(self):
sale_order = self.sale_id
if sale_order and self.carrier_id.invoice_policy == 'real' and self.carrier_price:
delivery_lines = sale_order.order_line.filtered(lambda l: l.is_delivery and l.currency_id.is_zero(l.price_unit) and l.product_id == self.carrier_id.product_id)
carrier_price = self.carrier_price * (1.0 + (float(self.carrier_id.margin) / 100.0))
if not delivery_lines:
sale_order._create_delivery_line(self.carrier_id, self.carrier_price)
sale_order._create_delivery_line(self.carrier_id, carrier_price)
delivery_line = delivery_lines[0]
'price_unit': self.carrier_price,
'price_unit': carrier_price,
# remove the estimated price from the description
'name': sale_order.carrier_id.with_context(lang=self.partner_id.lang).name,

0 comments on commit 621dac8

Please sign in to comment.
You can’t perform that action at this time.