Simplify manual alteration of shipment cost
issue10142 review340111002
This commit is contained in:
1 parent
b24fd8bb09
commit
5fdf8cc434
2 files changed
+19
-9
No files matched your search
@@ -48,7 +48,9 @@ class ShipmentOut(metaclass=PoolMeta):
|
||||
"""
|
||||
return ()
|
||||
|
||||
@fields.depends('carrier', 'inventory_moves',
|
||||
@fields.depends(
|
||||
'state', 'carrier', 'inventory_moves', 'outgoing_moves',
|
||||
'warehouse_storage', 'warehouse_output',
|
||||
methods=['_group_parcel_key'])
|
||||
def _get_carrier_context(self):
|
||||
context = super(ShipmentOut, self)._get_carrier_context()
|
||||
@@ -59,7 +61,11 @@ class ShipmentOut(metaclass=PoolMeta):
|
||||
weights = []
|
||||
context['weights'] = weights
|
||||
|
||||
lines = self.inventory_moves or []
|
||||
if (self.state in {'draft', 'waiting', 'assigned'}
|
||||
and self.warehouse_storage != self.warehouse_output):
|
||||
lines = self.inventory_moves or []
|
||||
else:
|
||||
lines = self.outgoing_moves or []
|
||||
keyfunc = partial(self._group_parcel_key, lines)
|
||||
lines = sorted(lines, key=sortable_values(keyfunc))
|
||||
|
||||
|
||||
@@ -133,9 +133,9 @@ Receive a single product line::
|
||||
>>> move.quantity = 4
|
||||
>>> move.unit_price = Decimal('8')
|
||||
>>> shipment.carrier = carrier
|
||||
>>> shipment.cost
|
||||
Decimal('25')
|
||||
>>> shipment.cost_currency == company.currency
|
||||
>>> shipment.cost_used
|
||||
Decimal('25.0000')
|
||||
>>> shipment.cost_currency_used == company.currency
|
||||
True
|
||||
>>> shipment.click('receive')
|
||||
>>> shipment.state
|
||||
@@ -188,15 +188,19 @@ Send products::
|
||||
>>> shipment, = sale.shipments
|
||||
>>> shipment.carrier == carrier
|
||||
True
|
||||
>>> shipment.cost
|
||||
>>> shipment.cost_used
|
||||
Decimal('40.0000')
|
||||
>>> shipment.cost_currency == company.currency
|
||||
>>> shipment.cost_sale_used
|
||||
Decimal('40.0000')
|
||||
>>> shipment.cost_sale_currency_used == company.currency
|
||||
True
|
||||
>>> move = shipment.inventory_moves[0]
|
||||
>>> move.quantity -= 1
|
||||
>>> shipment.cost
|
||||
>>> shipment.cost_used
|
||||
Decimal('25.0000')
|
||||
>>> shipment.cost_currency == company.currency
|
||||
>>> shipment.cost_sale_used
|
||||
Decimal('25.0000')
|
||||
>>> shipment.cost_sale_currency_used == company.currency
|
||||
True
|
||||
>>> shipment.state
|
||||
'waiting'
|
||||
|
||||
Reference in new issue
Block a user