Skip to content

Commit

Permalink
[IMP] delivery_purchase: Set carrier_price when creating a picking
Browse files Browse the repository at this point in the history
If we have a delivery price of 10 on the order, it is expected to show
10 on the picking (without needing to be set to that amount when set the
picking as done).

TT45656
  • Loading branch information
victoralmau committed Dec 14, 2023
1 parent ccc9f6e commit 4696a60
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions delivery_purchase/models/purchase_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def _prepare_picking(self):
res = super()._prepare_picking()
if self.carrier_id:
res["carrier_id"] = self.carrier_id.id
res["carrier_price"] = self.delivery_price
return res

def _create_delivery_line(self, carrier, price_unit):
Expand Down
2 changes: 2 additions & 0 deletions delivery_purchase/tests/test_delivery_purchase.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,11 @@ def test_delivery_purchase(self):
self.assertEqual(self.purchase.delivery_price, 30)

def test_picking_carrier_01(self):
self.assertEqual(self.purchase.delivery_price, 20)
self.purchase.button_confirm()
picking = self.purchase.picking_ids
self.assertEqual(picking.carrier_id, self.carrier_fixed)
self.assertEqual(picking.carrier_price, 20)
picking.carrier_id = self.carrier_rules.id
self._action_picking_validate(picking)
self.assertEqual(picking.carrier_price, 10)
Expand Down

0 comments on commit 4696a60

Please sign in to comment.