[FIX] delivery: Get correct carrier price on picking created from SO

Steps to reproduce:

* Create a sales order (SO).
* Assign a carrier.
* Don't press on "Set price" button next to carrier.
* Validate SO.
* Validate picking.
* Delivery line is added to the SO with price 0.

This is because the delivery SO line is added with the value of
picking carrier_price field, but that field hasn't been set.
If you modify on view carrier field, there's an onchange that
fills correct price, so I use that onchange method for getting
same results.
This commit is contained in:
Pedro M. Baeza
2018-02-08 10:17:06 +01:00
committed by Nicolas Martinelli
parent 66e76d681d
commit 84b0ec4da3
+3
View File
@@ -38,4 +38,7 @@ class StockMove(models.Model):
pickings.write({
'carrier_id': proc.sale_line_id.order_id.carrier_id.id,
})
# Get correct carrier price
for picking in pickings:
picking.onchange_carrier()
return res