[FIX] delivery: Wrong delivery costs on free_over = True

The calculation of the delivery cost for a sale order / invoice was not correct when
free over  a limit had been satisfied.

Steps to reproduce the bug:

- Set a delivery method DM with a fixed price = 10.0 and free when the amount of the order exceeds 100
- Create a SO for an amount of 150 and set on it DM
- Confirm the SO and deliver it

Bug:

A SO line with DM was created with a fixed price of 10.0 instead of 0.0

opw:1838070
This commit is contained in:
Goffin Simon
2018-04-25 09:17:00 +02:00
parent 7b6744ecb7
commit 019c8b9975
+2
View File
@@ -161,6 +161,8 @@ class StockPicking(models.Model):
def send_to_shipper(self):
self.ensure_one()
res = self.carrier_id.send_shipping(self)[0]
if self.carrier_id.free_over 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_tracking_ref = res['tracking_number']
order_currency = self.sale_id.currency_id or self.company_id.currency_id