Rename Uom to Unit for stock moves.

This commit is contained in:
Albert Cervera i Areny 2023-09-13 18:51:13 +02:00
parent ea1858d8f1
commit 78579d2719
2 changed files with 7 additions and 7 deletions

View File

@ -92,7 +92,7 @@ class PurchaseRequest(metaclass=PoolMeta):
'supply_date': (
request.supply_date or datetime.date.max),
'quantity': request.quantity,
'uom': request.uom,
'unit': request.unit,
})
new_requests = super(PurchaseRequest, cls).compare_requests(
@ -102,12 +102,12 @@ class PurchaseRequest(metaclass=PoolMeta):
for old_req in existing_req.get(
(new_req.product.id, new_req.warehouse.id), []):
if old_req['supply_date'] <= new_req.supply_date:
quantity = Uom.compute_qty(old_req['uom'],
old_req['quantity'], new_req.uom)
quantity = Uom.compute_qty(old_req['unit'],
old_req['quantity'], new_req.unit)
new_req.quantity = max(0.0, new_req.quantity - quantity)
new_req.computed_quantity = new_req.quantity
old_req['quantity'] = Uom.compute_qty(new_req.uom,
max(0.0, quantity - new_req.quantity), old_req['uom'])
old_req['quantity'] = Uom.compute_qty(new_req.unit,
max(0.0, quantity - new_req.quantity), old_req['unit'])
else:
break
return new_requests

View File

@ -92,7 +92,7 @@ Create a need for missing product::
>>> shipment_out.company = company
>>> move = shipment_out.outgoing_moves.new()
>>> move.product = product
>>> move.uom = unit
>>> move.unit = unit
>>> move.quantity = 1
>>> move.from_location = output_loc
>>> move.to_location = customer_loc
@ -138,7 +138,7 @@ Create more needs of the same product::
>>> shipment_out.company = company
>>> move = shipment_out.outgoing_moves.new()
>>> move.product = product
>>> move.uom = unit
>>> move.unit = unit
>>> move.quantity = 2.0
>>> move.from_location = output_loc
>>> move.to_location = customer_loc