diff --git a/modules/account_invoice_stock/account.py b/modules/account_invoice_stock/account.py
index c7cc7b679d..f63bcaa7cb 100644
--- a/modules/account_invoice_stock/account.py
+++ b/modules/account_invoice_stock/account.py
@@ -107,7 +107,7 @@ class InvoiceLine(metaclass=PoolMeta):
for stock_move in self.stock_moves:
if stock_move.state != 'cancelled':
quantity += Uom.compute_qty(
- stock_move.uom, stock_move.quantity, self.unit)
+ stock_move.unit, stock_move.quantity, self.unit)
return quantity
def get_shipments(self, name):
diff --git a/modules/account_invoice_stock/stock.py b/modules/account_invoice_stock/stock.py
index 63bde5c613..fd88c8a5ca 100644
--- a/modules/account_invoice_stock/stock.py
+++ b/modules/account_invoice_stock/stock.py
@@ -61,7 +61,7 @@ class Move(metaclass=PoolMeta):
for invoice_line in self.invoice_lines:
if invoice_line.invoice_state != 'cancelled':
quantity += Uom.compute_qty(
- invoice_line.unit, invoice_line.quantity, self.uom)
+ invoice_line.unit, invoice_line.quantity, self.unit)
return quantity
@classmethod
@@ -109,7 +109,7 @@ class Move(metaclass=PoolMeta):
line.invoice.currency, line.amount, self.currency)
if line.invoice.type == 'out' or not line.correction:
quantity += UoM.compute_qty(
- line.unit, line.quantity, self.uom)
+ line.unit, line.quantity, self.unit)
if quantity:
unit_price = round_price(amount / Decimal(str(quantity)))
return unit_price
diff --git a/modules/account_stock_anglo_saxon/stock.py b/modules/account_stock_anglo_saxon/stock.py
index f599ed8665..2dccd2087d 100644
--- a/modules/account_stock_anglo_saxon/stock.py
+++ b/modules/account_stock_anglo_saxon/stock.py
@@ -54,8 +54,8 @@ class Move(metaclass=PoolMeta):
cost_price_method = self.product.get_multivalue(
'cost_price_method', **self._cost_price_pattern)
if type_.endswith('supplier') and cost_price_method == 'fixed':
- cost_price = Uom.compute_price(self.product.default_uom,
- self.cost_price, self.uom)
+ cost_price = Uom.compute_price(
+ self.product.default_uom, self.cost_price, self.unit)
with Transaction().set_context(date=self.effective_date):
unit_price = Currency.compute(self.currency, self.unit_price,
self.company.currency, round=False)
@@ -102,9 +102,10 @@ class Move(metaclass=PoolMeta):
consumed_qty = 0.0
for move in moves:
- qty = Uom.compute_qty(move.uom,
- move.quantity - getattr(move, as_qty_field),
- move.product.default_uom, round=False)
+ qty = Uom.compute_qty(
+ move.unit,
+ move.quantity - getattr(move, as_qty_field),
+ move.product.default_uom, round=False)
if qty <= 0.0:
continue
if qty > quantity - consumed_qty:
@@ -116,8 +117,8 @@ class Move(metaclass=PoolMeta):
with Transaction().set_context(date=move.effective_date):
unit_price = Currency.compute(move.currency,
move.unit_price, move.company.currency, round=False)
- cost_price = Uom.compute_price(move.uom,
- unit_price, move.product.default_uom)
+ cost_price = Uom.compute_price(
+ move.unit, unit_price, move.product.default_uom)
else:
cost_price = move.cost_price
@@ -126,7 +127,7 @@ class Move(metaclass=PoolMeta):
@classmethod
def update_anglo_saxon_quantity_product_cost(cls, product, moves,
- quantity, uom, type_):
+ quantity, unit, type_):
'''
Return the cost for quantity based on lines.
Update anglo_saxon_quantity on the concerned moves.
@@ -138,8 +139,8 @@ class Move(metaclass=PoolMeta):
assert type_.startswith('in_') or type_.startswith('out_'), \
'wrong type'
- total_qty = Uom.compute_qty(uom, quantity, product.default_uom,
- round=False)
+ total_qty = Uom.compute_qty(
+ unit, quantity, product.default_uom, round=False)
as_qty_field = _get_field(type_)
cost = Decimal('0.0')
@@ -151,11 +152,11 @@ class Move(metaclass=PoolMeta):
cost += move_cost_price * Decimal(str(move_qty))
move_qty = Uom.compute_qty(
- product.default_uom, move_qty, move.uom, round=False)
+ product.default_uom, move_qty, move.unit, round=False)
# Avoid float rounding issue but allow only rounding precision lost
new_qty = (getattr(move, as_qty_field) or 0.0) + move_qty
- assert move.uom.round(new_qty) <= move.quantity
+ assert move.unit.round(new_qty) <= move.quantity
new_qty = min(new_qty, move.quantity)
cls.write([move], {
as_qty_field: new_qty,
diff --git a/modules/account_stock_continental/stock.py b/modules/account_stock_continental/stock.py
index f8ddeb66b1..45af021712 100644
--- a/modules/account_stock_continental/stock.py
+++ b/modules/account_stock_continental/stock.py
@@ -31,8 +31,8 @@ class Move(metaclass=PoolMeta):
unit_price = self.unit_price_company
else:
unit_price = self.cost_price
- unit_price = Uom.compute_price(self.product.default_uom,
- unit_price, self.uom)
+ unit_price = Uom.compute_price(
+ self.product.default_uom, unit_price, self.unit)
amount = self.company.currency.round(
Decimal(str(self.quantity)) * unit_price)
diff --git a/modules/account_stock_eu/stock.py b/modules/account_stock_eu/stock.py
index 2cccc9a179..b19d9eed74 100644
--- a/modules/account_stock_eu/stock.py
+++ b/modules/account_stock_eu/stock.py
@@ -421,21 +421,22 @@ class Move(metaclass=PoolMeta):
self.company.intrastat_currency,
round=False), ndigits)
- def _intrastat_quantity(self, uom):
+ def _intrastat_quantity(self, unit):
pool = Pool()
UoM = pool.get('product.uom')
- if self.uom.category == uom.category:
- return UoM.compute_qty(self.uom, self.quantity, uom, round=False)
+ if self.unit.category == unit.category:
+ return UoM.compute_qty(self.unit, self.quantity, unit, round=False)
elif (getattr(self, 'secondary_unit', None)
- and self.secondary_unit.category == uom.category):
+ and self.secondary_unit.category == unit.category):
return UoM.compute_qty(
- self.secondary_unit, self.secondary_quantity, uom, round=False)
+ self.secondary_unit, self.secondary_quantity, unit,
+ round=False)
if (self.product.volume
- and self.product.volume_uom.category == uom.category):
+ and self.product.volume_uom.category == unit.category):
return UoM.compute_qty(
self.product.volume_uom,
self.internal_quantity * self.product.volume,
- uom, round=False)
+ unit, round=False)
def _intrastat_counterparty(self):
pool = Pool()
diff --git a/modules/carrier_weight/common.py b/modules/carrier_weight/common.py
index c22a0f1408..07a8ffe91d 100644
--- a/modules/carrier_weight/common.py
+++ b/modules/carrier_weight/common.py
@@ -3,7 +3,7 @@
from trytond.pool import Pool
-def parcel_weight(parcel, carrier_uom, uom_field='uom'):
+def parcel_weight(parcel, carrier_uom, uom_field='unit'):
pool = Pool()
Uom = pool.get('product.uom')
diff --git a/modules/commission/stock.py b/modules/commission/stock.py
index 5a715c0be7..8f0276effd 100644
--- a/modules/commission/stock.py
+++ b/modules/commission/stock.py
@@ -47,7 +47,7 @@ class Move(metaclass=PoolMeta):
total += amount
if line.invoice.type == 'out' or not line.correction:
quantity += UoM.compute_qty(
- line.unit, line.quantity, self.uom)
+ line.unit, line.quantity, self.unit)
if quantity:
unit_price = round_price(total / Decimal(str(quantity)))
else:
diff --git a/modules/product_cost_fifo/move.py b/modules/product_cost_fifo/move.py
index d122ad0a3a..77c8295b29 100644
--- a/modules/product_cost_fifo/move.py
+++ b/modules/product_cost_fifo/move.py
@@ -77,8 +77,8 @@ class Move(metaclass=PoolMeta):
pool = Pool()
Uom = pool.get('product.uom')
- total_qty = Uom.compute_qty(self.uom, self.quantity,
- self.product.default_uom, round=False)
+ total_qty = Uom.compute_qty(
+ self.unit, self.quantity, self.product.default_uom, round=False)
with Transaction().set_context(company=self.company.id):
fifo_moves = self.product.get_fifo_move(total_qty)
@@ -90,11 +90,11 @@ class Move(metaclass=PoolMeta):
consumed_qty += move_qty
cost_price += move.get_cost_price() * Decimal(str(move_qty))
- move_qty = Uom.compute_qty(self.product.default_uom, move_qty,
- move.uom, round=False)
+ move_qty = Uom.compute_qty(
+ self.product.default_uom, move_qty, move.unit, round=False)
move.fifo_quantity = (move.fifo_quantity or 0.0) + move_qty
# Due to float, the fifo quantity result can exceed the quantity.
- assert move.quantity >= move.fifo_quantity - move.uom.rounding
+ assert move.quantity >= move.fifo_quantity - move.unit.rounding
move.fifo_quantity = min(move.fifo_quantity, move.quantity)
to_save.append(move)
diff --git a/modules/product_cost_fifo/product.py b/modules/product_cost_fifo/product.py
index 490cba0cca..2f0ea5fef3 100644
--- a/modules/product_cost_fifo/product.py
+++ b/modules/product_cost_fifo/product.py
@@ -74,7 +74,7 @@ class Product(metaclass=PoolMeta):
for move in moves():
qty = move.fifo_quantity_available if not date else move.quantity
qty = Uom.compute_qty(
- move.uom, qty, self.default_uom, round=False)
+ move.unit, qty, self.default_uom, round=False)
avail_qty -= qty
if avail_qty <= quantity:
@@ -204,7 +204,7 @@ class Product(metaclass=PoolMeta):
cost_price = Revision.apply_up_to(
revisions, cost_price, move.effective_date)
- qty = Uom.compute_qty(move.uom, move.quantity, self.default_uom)
+ qty = Uom.compute_qty(move.unit, move.quantity, self.default_uom)
qty = Decimal(str(qty))
if out_move(move):
qty *= -1
diff --git a/modules/product_cost_fifo/tests/scenario_product_cost_fifo.rst b/modules/product_cost_fifo/tests/scenario_product_cost_fifo.rst
index bf48f4527a..da742a46c3 100644
--- a/modules/product_cost_fifo/tests/scenario_product_cost_fifo.rst
+++ b/modules/product_cost_fifo/tests/scenario_product_cost_fifo.rst
@@ -52,7 +52,7 @@ Make 4 units of the product available @ 10 ::
>>> StockMove = Model.get('stock.move')
>>> incoming_move = StockMove()
>>> incoming_move.product = product
- >>> incoming_move.uom = unit
+ >>> incoming_move.unit = unit
>>> incoming_move.quantity = 4
>>> incoming_move.from_location = supplier_loc
>>> incoming_move.to_location = storage_loc
@@ -72,7 +72,7 @@ Add 2 more units @ 25 from production::
>>> incoming_move = StockMove()
>>> incoming_move.product = product
- >>> incoming_move.uom = unit
+ >>> incoming_move.unit = unit
>>> incoming_move.quantity = 2
>>> incoming_move.from_location = production_loc
>>> incoming_move.to_location = storage_loc
@@ -92,7 +92,7 @@ Sell 3 units @ 50::
>>> outgoing_move = StockMove()
>>> outgoing_move.product = product
- >>> outgoing_move.uom = unit
+ >>> outgoing_move.unit = unit
>>> outgoing_move.quantity = 3
>>> outgoing_move.from_location = storage_loc
>>> outgoing_move.to_location = customer_loc
@@ -117,7 +117,7 @@ Sell twice 1 more units @ 50::
>>> outgoing_moves = []
>>> outgoing_move = StockMove()
>>> outgoing_move.product = product
- >>> outgoing_move.uom = unit
+ >>> outgoing_move.unit = unit
>>> outgoing_move.quantity = 1
>>> outgoing_move.from_location = storage_loc
>>> outgoing_move.to_location = customer_loc
@@ -130,7 +130,7 @@ Sell twice 1 more units @ 50::
>>> outgoing_move = StockMove()
>>> outgoing_move.product = product
- >>> outgoing_move.uom = unit
+ >>> outgoing_move.unit = unit
>>> outgoing_move.quantity = 1
>>> outgoing_move.from_location = storage_loc
>>> outgoing_move.to_location = customer_loc
diff --git a/modules/product_cost_fifo/tests/scenario_product_cost_fifo_no_in.rst b/modules/product_cost_fifo/tests/scenario_product_cost_fifo_no_in.rst
index 711095c338..df7d0d18f8 100644
--- a/modules/product_cost_fifo/tests/scenario_product_cost_fifo_no_in.rst
+++ b/modules/product_cost_fifo/tests/scenario_product_cost_fifo_no_in.rst
@@ -50,7 +50,7 @@ Make 2 units of the product not available @ 60 and 80 ::
>>> StockMove = Model.get('stock.move')
>>> incoming_move = StockMove()
>>> incoming_move.product = product
- >>> incoming_move.uom = unit
+ >>> incoming_move.unit = unit
>>> incoming_move.quantity = 1
>>> incoming_move.from_location = supplier_loc
>>> incoming_move.to_location = storage_loc
@@ -63,7 +63,7 @@ Make 2 units of the product not available @ 60 and 80 ::
>>> incoming_move = StockMove()
>>> incoming_move.product = product
- >>> incoming_move.uom = unit
+ >>> incoming_move.unit = unit
>>> incoming_move.quantity = 1
>>> incoming_move.from_location = supplier_loc
>>> incoming_move.to_location = storage_loc
@@ -79,7 +79,7 @@ Sell 1 unit @ 200::
>>> StockMove = Model.get('stock.move')
>>> outgoing_move = StockMove()
>>> outgoing_move.product = product
- >>> outgoing_move.uom = unit
+ >>> outgoing_move.unit = unit
>>> outgoing_move.quantity = 1
>>> outgoing_move.from_location = storage_loc
>>> outgoing_move.to_location = customer_loc
diff --git a/modules/product_cost_fifo/tests/scenario_product_cost_fifo_uom.rst b/modules/product_cost_fifo/tests/scenario_product_cost_fifo_uom.rst
index 78a6de7006..7e9dfcc294 100644
--- a/modules/product_cost_fifo/tests/scenario_product_cost_fifo_uom.rst
+++ b/modules/product_cost_fifo/tests/scenario_product_cost_fifo_uom.rst
@@ -52,7 +52,7 @@ Make 4 kg of the product available @ 10 ::
>>> StockMove = Model.get('stock.move')
>>> incoming_move = StockMove()
>>> incoming_move.product = product
- >>> incoming_move.uom = kg
+ >>> incoming_move.unit = kg
>>> incoming_move.quantity = 4
>>> incoming_move.from_location = supplier_loc
>>> incoming_move.to_location = storage_loc
@@ -72,7 +72,7 @@ Add 2000 more g @ 0.025::
>>> incoming_move = StockMove()
>>> incoming_move.product = product
- >>> incoming_move.uom = g
+ >>> incoming_move.unit = g
>>> incoming_move.quantity = 2000
>>> incoming_move.from_location = supplier_loc
>>> incoming_move.to_location = storage_loc
@@ -92,7 +92,7 @@ Sell 3 kg @ 50::
>>> outgoing_move = StockMove()
>>> outgoing_move.product = product
- >>> outgoing_move.uom = kg
+ >>> outgoing_move.unit = kg
>>> outgoing_move.quantity = 3
>>> outgoing_move.from_location = storage_loc
>>> outgoing_move.to_location = customer_loc
@@ -115,7 +115,7 @@ Sell twice 1 more kg @ 50::
>>> outgoing_moves = []
>>> outgoing_move = StockMove()
>>> outgoing_move.product = product
- >>> outgoing_move.uom = kg
+ >>> outgoing_move.unit = kg
>>> outgoing_move.quantity = 1
>>> outgoing_move.from_location = storage_loc
>>> outgoing_move.to_location = customer_loc
@@ -128,7 +128,7 @@ Sell twice 1 more kg @ 50::
>>> outgoing_move = StockMove()
>>> outgoing_move.product = product
- >>> outgoing_move.uom = g
+ >>> outgoing_move.unit = g
>>> outgoing_move.quantity = 1000
>>> outgoing_move.from_location = storage_loc
>>> outgoing_move.to_location = customer_loc
diff --git a/modules/product_cost_warehouse/stock.py b/modules/product_cost_warehouse/stock.py
index ec62bac4b5..0bb24b1b07 100644
--- a/modules/product_cost_warehouse/stock.py
+++ b/modules/product_cost_warehouse/stock.py
@@ -95,7 +95,7 @@ class Move(metaclass=PoolMeta):
for outgoing_move in move.shipment.outgoing_moves:
if outgoing_move.product == move.product:
qty = Uom.compute_qty(
- outgoing_move.uom, outgoing_move.quantity,
+ outgoing_move.unit, outgoing_move.quantity,
move.product.default_uom)
qty = Decimal(str(qty))
cost += qty * outgoing_move.cost_price
diff --git a/modules/product_kit/common.py b/modules/product_kit/common.py
index 5b13bb92bb..cfacc23298 100644
--- a/modules/product_kit/common.py
+++ b/modules/product_kit/common.py
@@ -326,7 +326,7 @@ def order_line_component_mixin(prefix):
for move in self.moves:
if move not in skips:
quantity += Uom.compute_qty(
- move.uom, move.quantity, self.unit)
+ move.unit, move.quantity, self.unit)
return quantity
@property
@@ -339,7 +339,7 @@ def order_line_component_mixin(prefix):
for move in self.moves:
if move.state == 'done' or move in ignored:
quantity -= Uom.compute_qty(
- move.uom, move.quantity, self.unit)
+ move.unit, move.quantity, self.unit)
return quantity
def get_moves_exception(self, name):
@@ -365,7 +365,7 @@ def order_line_component_mixin(prefix):
for move in self.moves:
if move.state != 'done':
continue
- qty = Uom.compute_qty(move.uom, move.quantity, self.unit)
+ qty = Uom.compute_qty(move.unit, move.quantity, self.unit)
dest_type = self.line.to_location.type
if (move.to_location.type == dest_type
and move.from_location.type != dest_type):
diff --git a/modules/product_kit/purchase.py b/modules/product_kit/purchase.py
index 295f4bebf5..ce6ac0f29d 100644
--- a/modules/product_kit/purchase.py
+++ b/modules/product_kit/purchase.py
@@ -104,7 +104,7 @@ class LineComponent(
move = Move()
move.quantity = quantity
- move.uom = self.unit
+ move.unit = self.unit
move.product = self.product
move.from_location = self.line.from_location
move.to_location = self.line.to_location
diff --git a/modules/product_kit/sale.py b/modules/product_kit/sale.py
index 7b5598cb47..41452509ad 100644
--- a/modules/product_kit/sale.py
+++ b/modules/product_kit/sale.py
@@ -101,7 +101,7 @@ class LineComponent(
move = Move()
move.quantity = quantity
- move.uom = self.unit
+ move.unit = self.unit
move.product = self.product
move.from_location = self.line.from_location
move.to_location = self.line.to_location
diff --git a/modules/product_kit/stock.py b/modules/product_kit/stock.py
index 5b135e15f2..e7836e1bb9 100644
--- a/modules/product_kit/stock.py
+++ b/modules/product_kit/stock.py
@@ -26,7 +26,7 @@ class Move(metaclass=PoolMeta):
amount *= self.origin.price_ratio
if quantity:
unit_price = round_price(amount / Decimal(str(quantity)))
- unit_price = UoM.compute_price(self.origin.unit, unit_price, self.uom)
+ unit_price = UoM.compute_price(self.origin.unit, unit_price, self.unit)
return unit_price
diff --git a/modules/production/production.py b/modules/production/production.py
index 7823628511..f1c86f6238 100644
--- a/modules/production/production.py
+++ b/modules/production/production.py
@@ -364,7 +364,7 @@ class Production(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
assert type in {'input', 'output'}
move = Move(
product=product,
- uom=unit,
+ unit=unit,
quantity=quantity,
company=self.company,
currency=self.company.currency if self.company else None)
@@ -401,8 +401,9 @@ class Production(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
move = self._explode_move_values('input', input_, quantity)
if move:
inputs.append(move)
- quantity = Uom.compute_qty(input_.uom, quantity,
- input_.product.default_uom, round=False)
+ quantity = Uom.compute_qty(
+ input_.uom, quantity, input_.product.default_uom,
+ round=False)
self.inputs = inputs
outputs = []
@@ -475,13 +476,13 @@ class Production(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
for input_ in self.inputs:
if (input_.product is None
- or input_.uom is None
+ or input_.unit is None
or input_.quantity is None
or input_.state == 'cancelled'):
continue
product = input_.product
- quantity = Uom.compute_qty(input_.uom, input_.quantity,
- product.default_uom)
+ quantity = Uom.compute_qty(
+ input_.unit, input_.quantity, product.default_uom)
cost += Decimal(str(quantity)) * product.cost_price
return cost
@@ -573,7 +574,7 @@ class Production(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
cost_price = (
input_costs[product] / input_quantities[product])
unit_price = round_price(Uom.compute_price(
- product.default_uom, cost_price, output.uom))
+ product.default_uom, cost_price, output.unit))
if (output.unit_price != unit_price
or output.currency != production.company.currency):
output.unit_price = unit_price
@@ -599,7 +600,7 @@ class Production(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
continue
product_price = (Decimal(str(output.quantity))
* Uom.compute_price(
- product.default_uom, list_price, output.uom))
+ product.default_uom, list_price, output.unit))
prices[output] = product_price
sum_ += product_price
@@ -608,7 +609,7 @@ class Production(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
for output in outputs:
if output.product == production.product:
quantity = Uom.compute_qty(
- output.uom, output.quantity,
+ output.unit, output.quantity,
output.product.default_uom, round=False)
quantity = Decimal(str(quantity))
prices[output] = quantity
diff --git a/modules/purchase/purchase.py b/modules/purchase/purchase.py
index 9769c22d5e..d303197387 100644
--- a/modules/purchase/purchase.py
+++ b/modules/purchase/purchase.py
@@ -1312,7 +1312,8 @@ class Line(sequence_ordered(), ModelSQL, ModelView):
quantity = abs(self.quantity)
for move in self.moves:
if move.state == 'done' or move in skips:
- quantity -= Uom.compute_qty(move.uom, move.quantity, self.unit)
+ quantity -= Uom.compute_qty(
+ move.unit, move.quantity, self.unit)
return quantity
def get_moves_exception(self, name):
@@ -1699,7 +1700,7 @@ class Line(sequence_ordered(), ModelSQL, ModelView):
for move in self.moves:
if move.state != 'done':
continue
- qty = Uom.compute_qty(move.uom, move.quantity, self.unit)
+ qty = Uom.compute_qty(move.unit, move.quantity, self.unit)
# Test only against from_location
# as it is what matters for purchase
src_type = 'supplier'
@@ -1769,7 +1770,7 @@ class Line(sequence_ordered(), ModelSQL, ModelView):
party=self.purchase.party.rec_name))
move = Move()
move.quantity = quantity
- move.uom = self.unit
+ move.unit = self.unit
move.product = self.product
move.from_location = self.from_location
move.to_location = self.to_location
@@ -1796,8 +1797,8 @@ class Line(sequence_ordered(), ModelSQL, ModelView):
skip = set(self.moves_recreated)
for move in self.moves:
if move not in skip:
- quantity += Uom.compute_qty(move.uom, move.quantity,
- self.unit)
+ quantity += Uom.compute_qty(
+ move.unit, move.quantity, self.unit)
return quantity
def _get_move_invoice_lines(self, move_type):
@@ -1816,7 +1817,7 @@ class Line(sequence_ordered(), ModelSQL, ModelView):
for move in self.moves:
if move.state != 'cancelled' and self.unit:
moved_quantity += Uom.compute_qty(
- move.uom, move.quantity, self.unit, round=False)
+ move.unit, move.quantity, self.unit, round=False)
if self.quantity < 0:
moved_quantity *= -1
invoiced_quantity = 0
diff --git a/modules/purchase/view/move_list_shipment.xml b/modules/purchase/view/move_list_shipment.xml
index a34ffb6727..b407e6163a 100644
--- a/modules/purchase/view/move_list_shipment.xml
+++ b/modules/purchase/view/move_list_shipment.xml
@@ -5,7 +5,7 @@ this repository contains the full copyright notices and license terms. -->
-
+
diff --git a/modules/purchase_request/tests/scenario_purchase_request.rst b/modules/purchase_request/tests/scenario_purchase_request.rst
index dd57a70fab..82fded2e91 100644
--- a/modules/purchase_request/tests/scenario_purchase_request.rst
+++ b/modules/purchase_request/tests/scenario_purchase_request.rst
@@ -131,7 +131,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
diff --git a/modules/purchase_secondary_unit/purchase.py b/modules/purchase_secondary_unit/purchase.py
index 9410b06bfa..6e5465cd6e 100644
--- a/modules/purchase_secondary_unit/purchase.py
+++ b/modules/purchase_secondary_unit/purchase.py
@@ -166,7 +166,7 @@ class Line(metaclass=PoolMeta):
def get_move(self, move_type):
move = super().get_move(move_type)
if move and hasattr(move.__class__, 'secondary_unit'):
- if move.uom == self.unit:
+ if move.unit == self.unit:
move.secondary_unit = self.secondary_unit
return move
diff --git a/modules/purchase_shipment_cost/stock.py b/modules/purchase_shipment_cost/stock.py
index 63a6eb9b66..aa8afea390 100644
--- a/modules/purchase_shipment_cost/stock.py
+++ b/modules/purchase_shipment_cost/stock.py
@@ -173,8 +173,9 @@ class Move(metaclass=PoolMeta):
moves, quantity, type_):
if (type_.startswith('in_')
and move.unit_shipment_cost):
- shipment_cost = Uom.compute_price(move.uom,
- move.unit_shipment_cost, move.product.default_uom)
+ shipment_cost = Uom.compute_price(
+ move.unit, move.unit_shipment_cost,
+ move.product.default_uom)
shipment_cost = Currency.compute(move.currency,
shipment_cost, move.company.currency)
cost_price -= shipment_cost
diff --git a/modules/sale/sale.py b/modules/sale/sale.py
index ddf1c37af1..bb8e814f65 100644
--- a/modules/sale/sale.py
+++ b/modules/sale/sale.py
@@ -1397,7 +1397,8 @@ class SaleLine(TaxableMixin, sequence_ordered(), ModelSQL, ModelView):
quantity = abs(self.quantity)
for move in self.moves:
if move.state == 'done' or move in skips:
- quantity -= Uom.compute_qty(move.uom, move.quantity, self.unit)
+ quantity -= Uom.compute_qty(
+ move.unit, move.quantity, self.unit)
return quantity
def get_moves_exception(self, name):
@@ -1743,7 +1744,7 @@ class SaleLine(TaxableMixin, sequence_ordered(), ModelSQL, ModelView):
for move in self.moves:
if move.state != 'done':
continue
- qty = Uom.compute_qty(move.uom, move.quantity, self.unit)
+ qty = Uom.compute_qty(move.unit, move.quantity, self.unit)
# Test only against to_location
# as it is what matters for sale
dest_type = 'customer'
@@ -1814,7 +1815,7 @@ class SaleLine(TaxableMixin, sequence_ordered(), ModelSQL, ModelView):
party=self.sale.party.rec_name))
move = Move()
move.quantity = quantity
- move.uom = self.unit
+ move.unit = self.unit
move.product = self.product
move.from_location = self.from_location
move.to_location = self.to_location
@@ -1853,8 +1854,8 @@ class SaleLine(TaxableMixin, sequence_ordered(), ModelSQL, ModelView):
skips = set(m for m in self.moves_recreated)
for move in self.moves:
if move not in skips:
- quantity += Uom.compute_qty(move.uom, move.quantity,
- self.unit)
+ quantity += Uom.compute_qty(
+ move.unit, move.quantity, self.unit)
return quantity
def _get_move_invoice_lines(self, shipment_type):
@@ -1880,7 +1881,7 @@ class SaleLine(TaxableMixin, sequence_ordered(), ModelSQL, ModelView):
for move in self.moves:
if move.state != 'cancelled' and self.unit:
moved_quantity += Uom.compute_qty(
- move.uom, move.quantity, self.unit, round=False)
+ move.unit, move.quantity, self.unit, round=False)
if self.quantity < 0:
moved_quantity *= -1
invoiced_quantity = 0
diff --git a/modules/sale/view/move_list_shipment.xml b/modules/sale/view/move_list_shipment.xml
index baf7bf41ae..bd18cbd92c 100644
--- a/modules/sale/view/move_list_shipment.xml
+++ b/modules/sale/view/move_list_shipment.xml
@@ -5,7 +5,7 @@ this repository contains the full copyright notices and license terms. -->
-
+
diff --git a/modules/sale_gift_card/sale.py b/modules/sale_gift_card/sale.py
index 1e4913a7e9..c50756922a 100644
--- a/modules/sale_gift_card/sale.py
+++ b/modules/sale_gift_card/sale.py
@@ -139,9 +139,9 @@ class GiftCard(ModelSQL, ModelView):
move = self.origin
self.company = move.company
self.product = move.product
- if move.uom and move.unit_price:
+ if move.unit and move.unit_price:
self.value = UoM.compute_price(
- move.uom, move.unit_price, move.product.default_uom)
+ move.unit, move.unit_price, move.product.default_uom)
self.currency = move.currency
if self.value and self.currency:
self.value = self.currency.round(self.value)
diff --git a/modules/sale_point/sale.py b/modules/sale_point/sale.py
index e869224d71..e2469772a4 100644
--- a/modules/sale_point/sale.py
+++ b/modules/sale_point/sale.py
@@ -642,7 +642,7 @@ class POSSaleLine(ModelSQL, ModelView, TaxableMixin):
move = Move()
move.quantity = abs(self.quantity)
- move.uom = self.unit
+ move.unit = self.unit
move.product = self.product
move.from_location = self.from_location
move.to_location = self.to_location
diff --git a/modules/sale_secondary_unit/sale.py b/modules/sale_secondary_unit/sale.py
index 758e637bd7..1d37c1c57d 100644
--- a/modules/sale_secondary_unit/sale.py
+++ b/modules/sale_secondary_unit/sale.py
@@ -164,7 +164,7 @@ class Line(metaclass=PoolMeta):
def get_move(self, shipment_type):
move = super().get_move(shipment_type)
if move and hasattr(move.__class__, 'secondary_unit'):
- if move.uom == self.unit:
+ if move.unit == self.unit:
move.secondary_unit = self.secondary_unit
return move
diff --git a/modules/sale_shipment_tolerance/sale.py b/modules/sale_shipment_tolerance/sale.py
index 0cc6284e24..f5532a64ed 100644
--- a/modules/sale_shipment_tolerance/sale.py
+++ b/modules/sale_shipment_tolerance/sale.py
@@ -37,7 +37,7 @@ class Line(metaclass=PoolMeta):
# Compute tolerance only if there is already at least one move.
if move and set(self.moves) - set(self.moves_recreated):
quantity = Uom.compute_qty(
- move.uom, move.quantity, self.unit, round=False)
+ move.unit, move.quantity, self.unit, round=False)
if self._test_under_shipment_tolerance(quantity):
move = None
return move
diff --git a/modules/sale_supply/sale.py b/modules/sale_supply/sale.py
index 405543ce86..4522f2bf3a 100644
--- a/modules/sale_supply/sale.py
+++ b/modules/sale_supply/sale.py
@@ -290,7 +290,7 @@ class Line(metaclass=PoolMeta):
move_key = get_key(move, key[0])
if match(key, move_key):
qty = Uom.compute_qty(
- move.product.default_uom, quantity, move.uom,
+ move.product.default_uom, quantity, move.unit,
round=False)
qties_converted.append((key, qty))
to_pick = move.pick_product(qties_converted)
@@ -305,7 +305,7 @@ class Line(metaclass=PoolMeta):
first = True
for key, qty in to_pick:
values = dict(get_values(key, 'from_location'))
- values['quantity'] = move.uom.round(qty)
+ values['quantity'] = move.unit.round(qty)
if first:
to_write.extend([[move], values])
to_assign.append(move)
@@ -314,8 +314,8 @@ class Line(metaclass=PoolMeta):
with Transaction().set_context(_stock_move_split=True):
to_assign.extend(Move.copy([move], default=values))
- qty_default_uom = Uom.compute_qty(move.uom, qty,
- move.product.default_uom, round=False)
+ qty_default_uom = Uom.compute_qty(
+ move.unit, qty, move.product.default_uom, round=False)
quantities[key] -= qty_default_uom
if to_write:
diff --git a/modules/sale_supply_drop_shipment/stock.py b/modules/sale_supply_drop_shipment/stock.py
index aece46be0f..ac64e99d94 100644
--- a/modules/sale_supply_drop_shipment/stock.py
+++ b/modules/sale_supply_drop_shipment/stock.py
@@ -386,14 +386,14 @@ class ShipmentDrop(Workflow, ModelSQL, ModelView):
for move in filter(active, shipment.supplier_moves):
key = shipment._sync_move_key(move)
qty_default_uom = Uom.compute_qty(
- move.uom, move.quantity,
+ move.unit, move.quantity,
move.product.default_uom, round=False)
for customer_move in move.moves_drop:
customer_move = customer_moves.get(customer_move)
- if customer_move.uom.category != move.uom.category:
+ if customer_move.unit.category != move.unit.category:
continue
c_qty_default_uom = Uom.compute_qty(
- customer_move.uom, customer_move.quantity,
+ customer_move.unit, customer_move.quantity,
customer_move.product.default_uom, round=False)
qty = min(qty_default_uom, c_qty_default_uom)
supplier_qty[customer_move][key] += qty
@@ -414,7 +414,7 @@ class ShipmentDrop(Workflow, ModelSQL, ModelView):
for name, value in key:
setattr(move, name, value)
qty = Uom.compute_qty(
- move.product.default_uom, qty, move.uom)
+ move.product.default_uom, qty, move.unit)
if move.quantity != qty:
move.quantity = qty
moves.append(move)
@@ -423,7 +423,7 @@ class ShipmentDrop(Workflow, ModelSQL, ModelView):
def _sync_move_key(self, move):
return (
('product', move.product),
- ('uom', move.uom),
+ ('unit', move.unit),
)
def _sync_customer_move(self, template=None):
@@ -470,7 +470,7 @@ class ShipmentDrop(Workflow, ModelSQL, ModelView):
s_move.get_cost_price() * internal_quantity)
quantity = UoM.compute_qty(
- s_move.uom, s_move.quantity, s_move.product.default_uom,
+ s_move.unit, s_move.quantity, s_move.product.default_uom,
round=False)
s_product_qty[s_move.product] += quantity
diff --git a/modules/stock/CHANGELOG b/modules/stock/CHANGELOG
index 2bf3cf4379..ee8befefa1 100644
--- a/modules/stock/CHANGELOG
+++ b/modules/stock/CHANGELOG
@@ -1,3 +1,4 @@
+* Rename Uom to Unit for move and inventory
* Add product cost price to move
* Add location and date to inventory name
diff --git a/modules/stock/delivery_note.fodt b/modules/stock/delivery_note.fodt
index 0b9d7b762b..2e655637b7 100644
--- a/modules/stock/delivery_note.fodt
+++ b/modules/stock/delivery_note.fodt
@@ -484,7 +484,7 @@
<move.product.rec_name>
- <format_number_symbol(move.quantity, shipment.delivery_address.party.lang, move.uom, digits=move.uom.digits)>
+ <format_number_symbol(move.quantity, shipment.delivery_address.party.lang, move.unit, digits=move.unit.digits)>
@@ -497,4 +497,4 @@
</for>
-
\ No newline at end of file
+
diff --git a/modules/stock/internal_shipment.fodt b/modules/stock/internal_shipment.fodt
index d49f67eaa0..4d7f9fd425 100644
--- a/modules/stock/internal_shipment.fodt
+++ b/modules/stock/internal_shipment.fodt
@@ -506,7 +506,7 @@
<move.product.rec_name>
- <format_number_symbol(move.quantity, user.language, move.uom, digits=move.uom.digits)>
+ <format_number_symbol(move.quantity, user.language, move.unit, digits=move.unit.digits)>
diff --git a/modules/stock/inventory.py b/modules/stock/inventory.py
index 15246b1aca..224dac78a7 100644
--- a/modules/stock/inventory.py
+++ b/modules/stock/inventory.py
@@ -359,16 +359,18 @@ class InventoryLine(ModelSQL, ModelView):
domain=[
('type', '=', 'goods'),
], states=_states)
- uom = fields.Function(fields.Many2One('product.uom', 'UOM',
- help="The unit in which the quantity is specified."), 'get_uom')
+ unit = fields.Function(fields.Many2One(
+ 'product.uom', "Unit",
+ help="The unit in which the quantity is specified."),
+ 'get_unit')
expected_quantity = fields.Float(
- "Expected Quantity", digits='uom', required=True, readonly=True,
+ "Expected Quantity", digits='unit', required=True, readonly=True,
states={
'invisible': Eval('id', -1) < 0,
},
help="The quantity the system calculated should be in the location.")
quantity = fields.Float(
- "Actual Quantity", digits='uom', states=_states,
+ "Actual Quantity", digits='unit', states=_states,
help="The actual quantity found in the location.")
moves = fields.One2Many('stock.move', 'origin', 'Moves', readonly=True)
inventory = fields.Many2One('stock.inventory', 'Inventory', required=True,
@@ -408,7 +410,7 @@ class InventoryLine(ModelSQL, ModelView):
@fields.depends('product')
def on_change_product(self):
if self.product:
- self.uom = self.product.default_uom
+ self.unit = self.product.default_uom
@fields.depends('inventory', '_parent_inventory.location')
def on_change_with_inventory_location(self, name=None):
@@ -447,8 +449,8 @@ class InventoryLine(ModelSQL, ModelView):
def search_rec_name(cls, name, clause):
return [('product.rec_name',) + tuple(clause[1:])]
- def get_uom(self, name):
- return self.product.default_uom.id
+ def get_unit(self, name):
+ return self.product.default_uom
@property
def unique_key(self):
@@ -473,7 +475,6 @@ class InventoryLine(ModelSQL, ModelView):
'''
pool = Pool()
Move = pool.get('stock.move')
- Uom = pool.get('product.uom')
qty = self.quantity
if qty is None:
@@ -486,9 +487,7 @@ class InventoryLine(ModelSQL, ModelView):
else:
qty = 0.0
- delta_qty = Uom.compute_qty(self.uom,
- self.expected_quantity - qty,
- self.uom)
+ delta_qty = self.unit.round(self.expected_quantity - qty)
if delta_qty == 0.0:
return
from_location = self.inventory.location
@@ -507,7 +506,7 @@ class InventoryLine(ModelSQL, ModelView):
to_location=to_location,
quantity=delta_qty,
product=self.product,
- uom=self.uom,
+ unit=self.unit,
company=self.inventory.company,
effective_date=self.inventory.date,
origin=self,
@@ -583,8 +582,8 @@ class Count(Wizard):
line, = lines
values['line'] = line.id
values['product'] = line.product.id
- values['uom'] = line.uom.id
- if line.uom.rounding == 1:
+ values['unit'] = line.unit.id
+ if line.unit.rounding == 1:
values['quantity'] = 1.
return values
@@ -647,14 +646,15 @@ class CountQuantity(ModelView):
line = fields.Many2One(
'stock.inventory.line', "Line", readonly=True, required=True)
product = fields.Many2One('product.product', "Product", readonly=True)
- uom = fields.Many2One('product.uom', "UOM", readonly=True,
+ unit = fields.Many2One(
+ 'product.uom', "Unit", readonly=True,
help="The unit in which the quantities are specified.")
total_quantity = fields.Float(
- "Total Quantity", digits='uom', readonly=True,
+ "Total Quantity", digits='unit', readonly=True,
help="The total amount of the line counted so far.")
quantity = fields.Float(
- "Quantity", digits='uom', required=True,
+ "Quantity", digits='unit', required=True,
help="The quantity to add to the existing count.")
@fields.depends('quantity', 'line')
diff --git a/modules/stock/move.py b/modules/stock/move.py
index 3808257e57..a0c911cecc 100644
--- a/modules/stock/move.py
+++ b/modules/stock/move.py
@@ -187,7 +187,8 @@ class Move(Workflow, ModelSQL, ModelView):
product_uom_category = fields.Function(
fields.Many2One('product.uom.category', 'Product Uom Category'),
'on_change_with_product_uom_category')
- uom = fields.Many2One("product.uom", "Uom", required=True,
+ unit = fields.Many2One(
+ 'product.uom', "Unit", required=True,
states={
'readonly': (Eval('state').in_(['cancelled', 'assigned', 'done'])
| Eval('unit_price')),
@@ -199,7 +200,7 @@ class Move(Workflow, ModelSQL, ModelView):
],
help="The unit in which the quantity is specified.")
quantity = fields.Float(
- "Quantity", digits='uom', required=True,
+ "Quantity", digits='unit', required=True,
states=STATES,
help="The amount of stock moved.")
internal_quantity = fields.Float('Internal Quantity', readonly=True,
@@ -399,6 +400,12 @@ class Move(Workflow, ModelSQL, ModelView):
def __register__(cls, module_name):
cursor = Transaction().connection.cursor()
sql_table = cls.__table__()
+ table_h = cls.__table_handler__(module_name)
+
+ # Migration from 6.8: rename uom to unit
+ if (table_h.column_exist('uom')
+ and not table_h.column_exist('unit')):
+ table_h.column_rename('uom', 'unit')
super(Move, cls).__register__(module_name)
@@ -427,12 +434,13 @@ class Move(Workflow, ModelSQL, ModelView):
def default_unit_price_updated(cls):
return True
- @fields.depends('product', 'uom')
+ @fields.depends('product', 'unit')
def on_change_product(self):
if self.product:
- if (not self.uom
- or self.uom.category != self.product.default_uom.category):
- self.uom = self.product.default_uom
+ default_uom = self.product.default_uom
+ if (not self.unit
+ or self.unit.category != default_uom.category):
+ self.unit = default_uom
@fields.depends('product')
def on_change_with_product_uom_category(self, name=None):
@@ -456,7 +464,7 @@ class Move(Workflow, ModelSQL, ModelView):
move.currency, move.unit_price,
move.company.currency, round=False)
unit_price = Uom.compute_price(
- move.uom, unit_price, move.product.default_uom)
+ move.unit, unit_price, move.product.default_uom)
prices[move.id] = round_price(unit_price)
else:
prices[move.id] = None
@@ -577,7 +585,7 @@ class Move(Workflow, ModelSQL, ModelView):
Lang = pool.get('ir.lang')
lang = Lang.get()
return (lang.format_number_symbol(
- self.quantity, self.uom, digits=self.uom.digits)
+ self.quantity, self.unit, digits=self.unit.digits)
+ ' %s' % self.product.rec_name)
@classmethod
@@ -596,7 +604,7 @@ class Move(Workflow, ModelSQL, ModelView):
quantity = self.quantity
elif direction == 'out':
quantity = -self.quantity
- qty = Uom.compute_qty(self.uom, quantity, self.product.default_uom)
+ qty = Uom.compute_qty(self.unit, quantity, self.product.default_uom)
qty = Decimal(str(qty))
product_qty = Decimal(str(self.product.quantity))
@@ -614,10 +622,10 @@ class Move(Workflow, ModelSQL, ModelView):
return round_price(new_cost_price)
@staticmethod
- def _get_internal_quantity(quantity, uom, product):
+ def _get_internal_quantity(quantity, unit, product):
Uom = Pool().get('product.uom')
- internal_quantity = Uom.compute_qty(uom, quantity,
- product.default_uom, round=True)
+ internal_quantity = Uom.compute_qty(
+ unit, quantity, product.default_uom, round=True)
return internal_quantity
def set_effective_date(self):
@@ -820,19 +828,19 @@ class Move(Workflow, ModelSQL, ModelView):
vlist = [x.copy() for x in vlist]
# Use ordered dict to optimize cache alignment
- products, uoms = OrderedDict(), OrderedDict()
+ products, units = OrderedDict(), OrderedDict()
for vals in vlist:
products[vals['product']] = None
- uoms[vals['uom']] = None
+ units[vals['unit']] = None
id2product = {p.id: p for p in Product.browse(products.keys())}
- id2uom = {u.id: u for u in Uom.browse(uoms.keys())}
+ id2unit = {u.id: u for u in Uom.browse(units.keys())}
for vals in vlist:
assert vals.get('state', cls.default_state()
) in ['draft', 'staging']
product = id2product[int(vals['product'])]
- uom = id2uom[int(vals['uom'])]
+ unit = id2unit[int(vals['unit'])]
internal_quantity = cls._get_internal_quantity(
- vals['quantity'], uom, product)
+ vals['quantity'], unit, product)
vals['internal_quantity'] = internal_quantity
moves = super(Move, cls).create(vlist)
cls.check_period_closed(moves)
@@ -865,8 +873,8 @@ class Move(Workflow, ModelSQL, ModelView):
if any(f not in cls._allow_modify_closed_period for f in values):
cls.check_period_closed(moves)
for move in moves:
- internal_quantity = cls._get_internal_quantity(move.quantity,
- move.uom, move.product)
+ internal_quantity = cls._get_internal_quantity(
+ move.quantity, move.unit, move.product)
if (internal_quantity != move.internal_quantity
and internal_quantity
!= values.get('internal_quantity')):
@@ -940,7 +948,7 @@ class Move(Workflow, ModelSQL, ModelView):
needed_qty = self.quantity
for key, available_qty in quantities:
# Ignore available_qty when too small
- if available_qty < self.uom.rounding:
+ if available_qty < self.unit.rounding:
continue
if needed_qty <= available_qty:
to_pick.append((key, needed_qty))
@@ -1074,7 +1082,7 @@ class Move(Workflow, ModelSQL, ModelView):
move_key = get_key(move, key[0])
if match(key, move_key):
qty = Uom.compute_qty(
- move.product.default_uom, qty, move.uom,
+ move.product.default_uom, qty, move.unit,
round=False)
location_qties.append((key, qty))
@@ -1086,11 +1094,11 @@ class Move(Workflow, ModelSQL, ModelView):
for _, qty in to_pick:
picked_qties += qty
- if move.quantity - picked_qties >= move.uom.rounding:
+ if move.quantity - picked_qties >= move.unit.rounding:
success = False
first = False
values = {
- 'quantity': move.uom.round(
+ 'quantity': move.unit.round(
move.quantity - picked_qties),
}
to_write.extend([[move], values])
@@ -1098,7 +1106,7 @@ class Move(Workflow, ModelSQL, ModelView):
first = True
for key, qty in to_pick:
values = dict(get_values(key, 'from_location'))
- values['quantity'] = move.uom.round(qty)
+ values['quantity'] = move.unit.round(qty)
if first:
to_write.extend([[move], values])
to_assign.append(move)
@@ -1106,8 +1114,8 @@ class Move(Workflow, ModelSQL, ModelView):
else:
to_copy[move].append(values)
- qty_default_uom = Uom.compute_qty(move.uom, qty,
- move.product.default_uom, round=False)
+ qty_default_uom = Uom.compute_qty(
+ move.unit, qty, move.product.default_uom, round=False)
pbl[key] = pbl.get(key, 0.0) - qty_default_uom
diff --git a/modules/stock/picking_list.fodt b/modules/stock/picking_list.fodt
index 4a1cddd007..4f5ef66102 100644
--- a/modules/stock/picking_list.fodt
+++ b/modules/stock/picking_list.fodt
@@ -468,7 +468,7 @@
<move.product.rec_name>
- <format_number_symbol(move.quantity, user.language, move.uom, digits=move.uom.digits)>
+ <format_number_symbol(move.quantity, user.language, move.unit, digits=move.unit.digits)>
diff --git a/modules/stock/product.py b/modules/stock/product.py
index 77a6eec740..be8980c667 100644
--- a/modules/stock/product.py
+++ b/modules/stock/product.py
@@ -488,7 +488,7 @@ class Product(StockMixin, object, metaclass=PoolMeta):
cost_price = Revision.apply_up_to(
revisions, cost_price, move.effective_date)
- qty = Uom.compute_qty(move.uom, move.quantity, self.default_uom)
+ qty = Uom.compute_qty(move.unit, move.quantity, self.default_uom)
qty = Decimal(str(qty))
if out_move(move):
qty *= -1
diff --git a/modules/stock/shipment.py b/modules/stock/shipment.py
index 166685aa31..9c5bc162e2 100644
--- a/modules/stock/shipment.py
+++ b/modules/stock/shipment.py
@@ -514,7 +514,7 @@ class ShipmentIn(ShipmentMixin, Workflow, ModelSQL, ModelView):
today = Date.today()
move = Move()
move.product = incoming_move.product
- move.uom = incoming_move.uom
+ move.unit = incoming_move.unit
move.quantity = incoming_move.quantity
move.from_location = incoming_move.to_location
move.to_location = self.warehouse_storage
@@ -1431,15 +1431,15 @@ class ShipmentOut(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
if (inventory_move.origin == move
and inventory_move.state != 'cancelled'):
quantity -= Uom.compute_qty(
- inventory_move.uom, inventory_move.quantity, move.uom)
- quantity = move.uom.round(quantity)
+ inventory_move.unit, inventory_move.quantity, move.unit)
+ quantity = move.unit.round(quantity)
if quantity <= 0:
return
inventory_move = Move(
from_location=self.warehouse_storage,
to_location=move.from_location,
product=move.product,
- uom=move.uom,
+ unit=move.unit,
quantity=quantity,
shipment=self,
planned_date=move.planned_date,
@@ -1494,7 +1494,7 @@ class ShipmentOut(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
def _sync_move_key(self, move):
return (
('product', move.product),
- ('uom', move.uom),
+ ('unit', move.unit),
)
def _sync_outgoing_move(self, template=None):
@@ -1544,7 +1544,7 @@ class ShipmentOut(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
key = shipment._sync_move_key(move)
outgoing_move = outgoing_moves.get(move.origin)
qty_default_uom = Uom.compute_qty(
- move.uom, move.quantity,
+ move.unit, move.quantity,
move.product.default_uom, round=False)
inventory_qty[outgoing_move][key] += qty_default_uom
inventory_moves[outgoing_move][key].append(move)
@@ -1567,8 +1567,7 @@ class ShipmentOut(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
imove.origin = move
imoves.append(imove)
qty = Uom.compute_qty(
- move.product.default_uom, qty,
- move.uom)
+ move.product.default_uom, qty, move.unit)
if quantity and move.quantity != qty:
move.quantity = qty
moves.append(move)
@@ -2168,7 +2167,7 @@ class ShipmentOutReturn(ShipmentMixin, Workflow, ModelSQL, ModelView):
today = Date.today()
move = Move()
move.product = incoming_move.product
- move.uom = incoming_move.uom
+ move.unit = incoming_move.unit
move.quantity = incoming_move.quantity
move.from_location = incoming_move.to_location
move.to_location = self.warehouse_storage
@@ -2628,7 +2627,7 @@ class ShipmentInternal(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
def _sync_move_key(self, move):
return (
('product', move.product),
- ('uom', move.uom),
+ ('unit', move.unit),
)
def _sync_incoming_move(self, template=None):
@@ -2677,7 +2676,7 @@ class ShipmentInternal(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
key = shipment._sync_move_key(move)
incoming_move = incoming_moves.get(move.origin)
qty_default_uom = Uom.compute_qty(
- move.uom, move.quantity,
+ move.unit, move.quantity,
move.product.default_uom, round=False)
outgoing_qty[incoming_move][key] += qty_default_uom
outgoing_moves[incoming_move][key].append(move)
@@ -2696,8 +2695,7 @@ class ShipmentInternal(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
omove.origin = move
omoves.append(omove)
qty = Uom.compute_qty(
- move.product.default_uom, qty,
- move.uom)
+ move.product.default_uom, qty, move.unit)
if move.quantity != qty:
move.quantity = qty
moves.append(move)
diff --git a/modules/stock/supplier_restocking_list.fodt b/modules/stock/supplier_restocking_list.fodt
index 04630c3edc..b8ea3b7870 100644
--- a/modules/stock/supplier_restocking_list.fodt
+++ b/modules/stock/supplier_restocking_list.fodt
@@ -460,7 +460,7 @@
<move.product.rec_name>
- <format_number_symbol(move.quantity, user.language, move.uom, digits=move.uom.digits)>
+ <format_number_symbol(move.quantity, user.language, move.unit, digits=move.unit.digits)>
diff --git a/modules/stock/tests/scenario_stock_average_cost_price.rst b/modules/stock/tests/scenario_stock_average_cost_price.rst
index c01f8e269f..088f9b5cb9 100644
--- a/modules/stock/tests/scenario_stock_average_cost_price.rst
+++ b/modules/stock/tests/scenario_stock_average_cost_price.rst
@@ -67,7 +67,7 @@ Make 1 unit of the product available @ 100 ::
>>> StockMove = Model.get('stock.move')
>>> incoming_move = StockMove()
>>> incoming_move.product = product
- >>> incoming_move.uom = unit
+ >>> incoming_move.unit = unit
>>> incoming_move.quantity = 1
>>> incoming_move.from_location = supplier_loc
>>> incoming_move.to_location = storage_sub_loc
@@ -88,7 +88,7 @@ Add 1 more unit @ 200::
>>> incoming_move = StockMove()
>>> incoming_move.product = product
- >>> incoming_move.uom = unit
+ >>> incoming_move.unit = unit
>>> incoming_move.quantity = 1
>>> incoming_move.from_location = supplier_loc
>>> incoming_move.to_location = storage_loc
@@ -110,7 +110,7 @@ Add twice 1 more unit @ 200::
>>> incoming_moves = []
>>> incoming_move = StockMove()
>>> incoming_move.product = product
- >>> incoming_move.uom = unit
+ >>> incoming_move.unit = unit
>>> incoming_move.quantity = 1
>>> incoming_move.from_location = supplier_loc
>>> incoming_move.to_location = storage_loc
@@ -124,7 +124,7 @@ Add twice 1 more unit @ 200::
>>> incoming_move = StockMove()
>>> incoming_move.product = product
- >>> incoming_move.uom = unit
+ >>> incoming_move.unit = unit
>>> incoming_move.quantity = 1
>>> incoming_move.from_location = supplier_loc
>>> incoming_move.to_location = storage_loc
@@ -168,7 +168,7 @@ Send one product we don't have in stock::
>>> outgoing_move = StockMove()
>>> outgoing_move.product = negative_product
- >>> outgoing_move.uom = unit
+ >>> outgoing_move.unit = unit
>>> outgoing_move.quantity = 1
>>> outgoing_move.unit_price = Decimal('28')
>>> outgoing_move.from_location = storage_loc
@@ -188,7 +188,7 @@ Return one product to the supplier::
>>> outgoing_move = StockMove()
>>> outgoing_move.product = negative_product
- >>> outgoing_move.uom = unit
+ >>> outgoing_move.unit = unit
>>> outgoing_move.quantity = 1
>>> outgoing_move.unit_price = Decimal('28')
>>> outgoing_move.currency = company.currency
@@ -208,7 +208,7 @@ Receive one unit of the product with negative stock so the stock stays negative:
>>> incoming_move = StockMove()
>>> incoming_move.product = negative_product
- >>> incoming_move.uom = unit
+ >>> incoming_move.unit = unit
>>> incoming_move.quantity = 1
>>> incoming_move.from_location = supplier_loc
>>> incoming_move.to_location = storage_loc
@@ -229,7 +229,7 @@ Receive two units of the product so the stock becomes positive::
>>> incoming_move = StockMove()
>>> incoming_move.product = negative_product
- >>> incoming_move.uom = unit
+ >>> incoming_move.unit = unit
>>> incoming_move.quantity = 2
>>> incoming_move.from_location = supplier_loc
>>> incoming_move.to_location = storage_loc
diff --git a/modules/stock/tests/scenario_stock_inventory.rst b/modules/stock/tests/scenario_stock_inventory.rst
index e5d1275449..d07cf9f1e4 100644
--- a/modules/stock/tests/scenario_stock_inventory.rst
+++ b/modules/stock/tests/scenario_stock_inventory.rst
@@ -76,7 +76,7 @@ Fill storage::
>>> StockMove = Model.get('stock.move')
>>> incoming_move = StockMove()
>>> incoming_move.product = product
- >>> incoming_move.uom = unit
+ >>> incoming_move.unit = unit
>>> incoming_move.quantity = 1
>>> incoming_move.from_location = supplier_loc
>>> incoming_move.to_location = storage_loc
@@ -89,7 +89,7 @@ Fill storage::
>>> incoming_move = StockMove()
>>> incoming_move.product = product2
- >>> incoming_move.uom = kg
+ >>> incoming_move.unit = kg
>>> incoming_move.quantity = 2.5
>>> incoming_move.from_location = supplier_loc
>>> incoming_move.to_location = storage_loc
@@ -123,7 +123,7 @@ Fill storage with more quantities::
>>> incoming_move = StockMove()
>>> incoming_move.product = product
- >>> incoming_move.uom = unit
+ >>> incoming_move.unit = unit
>>> incoming_move.quantity = 1
>>> incoming_move.from_location = supplier_loc
>>> incoming_move.to_location = storage_loc
@@ -136,7 +136,7 @@ Fill storage with more quantities::
>>> incoming_move = StockMove()
>>> incoming_move.product = product2
- >>> incoming_move.uom = kg
+ >>> incoming_move.unit = kg
>>> incoming_move.quantity = 1.3
>>> incoming_move.from_location = supplier_loc
>>> incoming_move.to_location = storage_loc
diff --git a/modules/stock/tests/scenario_stock_inventory_empty_quantity.rst b/modules/stock/tests/scenario_stock_inventory_empty_quantity.rst
index 2f6b39b270..bedc658325 100644
--- a/modules/stock/tests/scenario_stock_inventory_empty_quantity.rst
+++ b/modules/stock/tests/scenario_stock_inventory_empty_quantity.rst
@@ -52,7 +52,7 @@ Fill storage::
>>> StockMove = Model.get('stock.move')
>>> incoming_move = StockMove()
>>> incoming_move.product = product
- >>> incoming_move.uom = unit
+ >>> incoming_move.unit = unit
>>> incoming_move.quantity = 1
>>> incoming_move.from_location = supplier_loc
>>> incoming_move.to_location = storage_loc
diff --git a/modules/stock/tests/scenario_stock_product_quantities_by_warehouse.rst b/modules/stock/tests/scenario_stock_product_quantities_by_warehouse.rst
index fc7761003d..c653f5bea1 100644
--- a/modules/stock/tests/scenario_stock_product_quantities_by_warehouse.rst
+++ b/modules/stock/tests/scenario_stock_product_quantities_by_warehouse.rst
@@ -53,7 +53,7 @@ Fill warehouse::
>>> move.product = product
>>> move.from_location = supplier_loc
>>> move.to_location = storage_loc
- >>> move.uom = unit
+ >>> move.unit = unit
>>> move.quantity = 10
>>> move.effective_date = yesterday
>>> move.unit_price = Decimal('10')
@@ -66,7 +66,7 @@ Forecast some moves::
>>> move.product = product
>>> move.from_location = storage_loc
>>> move.to_location = customer_loc
- >>> move.uom = unit
+ >>> move.unit = unit
>>> move.quantity = 6
>>> move.planned_date = tomorrow
>>> move.unit_price = Decimal('20')
@@ -77,7 +77,7 @@ Forecast some moves::
>>> move.product = product
>>> move.from_location = supplier_loc
>>> move.to_location = storage_loc
- >>> move.uom = unit
+ >>> move.unit = unit
>>> move.quantity = 5
>>> move.planned_date = tomorrow
>>> move.unit_price = Decimal('10')
@@ -88,7 +88,7 @@ Forecast some moves::
>>> move.product = product
>>> move.from_location = storage_loc
>>> move.to_location = customer_loc
- >>> move.uom = unit
+ >>> move.unit = unit
>>> move.quantity = 3
>>> move.planned_date = tomorrow
>>> move.unit_price = Decimal('20')
diff --git a/modules/stock/tests/scenario_stock_reporting.rst b/modules/stock/tests/scenario_stock_reporting.rst
index fd9a1f285f..994dc5e199 100644
--- a/modules/stock/tests/scenario_stock_reporting.rst
+++ b/modules/stock/tests/scenario_stock_reporting.rst
@@ -69,7 +69,7 @@ Receive a bunch of products::
>>> move = shipment_in.incoming_moves.new()
>>> move.product = product
- >>> move.uom = unit
+ >>> move.unit = unit
>>> move.quantity = 100
>>> move.from_location = supplier_loc
>>> move.to_location = input_loc
@@ -102,7 +102,7 @@ Add two shipment lines of same product and go through the workflow::
>>> 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
@@ -142,7 +142,7 @@ Create an internal shipment::
>>> shipment_internal.to_location = lost_loc
>>> move = shipment_internal.moves.new()
>>> move.product = product
- >>> move.uom = unit
+ >>> move.unit = unit
>>> move.quantity = 1
>>> move.from_location = storage_loc
>>> move.to_location = lost_loc
diff --git a/modules/stock/tests/scenario_stock_shipment_in_return.rst b/modules/stock/tests/scenario_stock_shipment_in_return.rst
index 258bf83864..bd3a3621fe 100644
--- a/modules/stock/tests/scenario_stock_shipment_in_return.rst
+++ b/modules/stock/tests/scenario_stock_shipment_in_return.rst
@@ -58,7 +58,7 @@ Create Shipment In::
>>> shipment_return.from_location = storage_loc
>>> move = shipment_return.moves.new()
>>> move.product = product
- >>> move.uom =unit
+ >>> move.unit =unit
>>> move.quantity = 1
>>> move.from_location = storage_loc
>>> move.to_location = supplier_loc
diff --git a/modules/stock/tests/scenario_stock_shipment_in_same_storage_input.rst b/modules/stock/tests/scenario_stock_shipment_in_same_storage_input.rst
index 8beb503b86..13da464bf9 100644
--- a/modules/stock/tests/scenario_stock_shipment_in_same_storage_input.rst
+++ b/modules/stock/tests/scenario_stock_shipment_in_same_storage_input.rst
@@ -61,7 +61,7 @@ Create Shipment In::
>>> shipment_in.company = company
>>> move = shipment_in.incoming_moves.new()
>>> move.product = product
- >>> move.uom = unit
+ >>> move.unit = unit
>>> move.quantity = 1
>>> move.unit_price = Decimal('5')
>>> move.currency = company.currency
diff --git a/modules/stock/tests/scenario_stock_shipment_internal.rst b/modules/stock/tests/scenario_stock_shipment_internal.rst
index a678ff6cfc..8c3f156a08 100644
--- a/modules/stock/tests/scenario_stock_shipment_internal.rst
+++ b/modules/stock/tests/scenario_stock_shipment_internal.rst
@@ -104,7 +104,7 @@ Create Internal Shipment from lost_found location::
>>> move = StockMove()
>>> move = lost_found_shipment.moves.new()
>>> move.product = product
- >>> move.uom = unit
+ >>> move.unit = unit
>>> move.quantity = 2
>>> move.from_location = lost_found_loc
>>> move.to_location = internal_loc
diff --git a/modules/stock/tests/scenario_stock_shipment_out.rst b/modules/stock/tests/scenario_stock_shipment_out.rst
index 62f3e08069..ab456c71e9 100644
--- a/modules/stock/tests/scenario_stock_shipment_out.rst
+++ b/modules/stock/tests/scenario_stock_shipment_out.rst
@@ -88,7 +88,7 @@ Add two shipment lines of same product::
>>> shipment_out.outgoing_moves.extend([StockMove(), StockMove()])
>>> for move in shipment_out.outgoing_moves:
... move.product = product
- ... move.uom =unit
+ ... move.unit =unit
... move.quantity = 1
... move.from_location = output_loc
... move.to_location = customer_loc
@@ -118,7 +118,7 @@ Make 1 unit of the product available::
>>> incoming_move = StockMove()
>>> incoming_move.product = product
- >>> incoming_move.uom = unit
+ >>> incoming_move.unit = unit
>>> incoming_move.quantity = 1
>>> incoming_move.from_location = supplier_loc
>>> incoming_move.to_location = storage_loc
@@ -221,7 +221,7 @@ Create Shipment Out with effective date::
>>> 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
@@ -234,7 +234,7 @@ Make 1 unit of the product available::
>>> incoming_move = StockMove()
>>> incoming_move.product = product
- >>> incoming_move.uom = unit
+ >>> incoming_move.unit = unit
>>> incoming_move.quantity = 1
>>> incoming_move.from_location = supplier_loc
>>> incoming_move.to_location = storage_loc
diff --git a/modules/stock/tests/scenario_stock_shipment_out_return_same_storage_input.rst b/modules/stock/tests/scenario_stock_shipment_out_return_same_storage_input.rst
index a06869a651..bbb5d50275 100644
--- a/modules/stock/tests/scenario_stock_shipment_out_return_same_storage_input.rst
+++ b/modules/stock/tests/scenario_stock_shipment_out_return_same_storage_input.rst
@@ -62,7 +62,7 @@ Create Shipment Out Return::
>>> shipment.company = company
>>> move = shipment.incoming_moves.new()
>>> move.product = product
- >>> move.uom = unit
+ >>> move.unit = unit
>>> move.quantity = 1
>>> move.from_location = customer_loc
>>> move.to_location = storage1
diff --git a/modules/stock/tests/scenario_stock_shipment_out_same_storage_output.rst b/modules/stock/tests/scenario_stock_shipment_out_same_storage_output.rst
index 7a9254d75b..9189131879 100644
--- a/modules/stock/tests/scenario_stock_shipment_out_same_storage_output.rst
+++ b/modules/stock/tests/scenario_stock_shipment_out_same_storage_output.rst
@@ -57,7 +57,7 @@ Create Shipment Out::
>>> shipment_out.company = company
>>> move = shipment_out.outgoing_moves.new()
>>> move.product = product
- >>> move.uom = unit
+ >>> move.unit = unit
>>> move.quantity = 1
>>> move.unit_price = Decimal('5')
>>> move.currency = company.currency
diff --git a/modules/stock/tests/test_module.py b/modules/stock/tests/test_module.py
index ec8d9095f4..2f7a86099e 100644
--- a/modules/stock/tests/test_module.py
+++ b/modules/stock/tests/test_module.py
@@ -53,10 +53,10 @@ class StockTestCase(
(g, 1, 0, 0), # rounded
(kg, 35.23, 35.23, 2), # check infinite loop
]
- for uom, quantity, internal_quantity, ndigits in tests:
+ for unit, quantity, internal_quantity, ndigits in tests:
move, = Move.create([{
'product': product.id,
- 'uom': uom.id,
+ 'unit': unit.id,
'quantity': quantity,
'from_location': supplier.id,
'to_location': storage.id,
@@ -67,9 +67,9 @@ class StockTestCase(
self.assertEqual(round(move.internal_quantity, ndigits),
internal_quantity)
- for uom, quantity, internal_quantity, ndigits in tests:
+ for unit, quantity, internal_quantity, ndigits in tests:
Move.write([move], {
- 'uom': uom.id,
+ 'unit': unit.id,
'quantity': quantity,
})
self.assertEqual(round(move.internal_quantity, ndigits),
@@ -108,7 +108,7 @@ class StockTestCase(
moves = Move.create([{
'product': product.id,
- 'uom': kg.id,
+ 'unit': kg.id,
'quantity': 5,
'from_location': supplier.id,
'to_location': storage.id,
@@ -119,7 +119,7 @@ class StockTestCase(
'currency': currency.id,
}, {
'product': product.id,
- 'uom': kg.id,
+ 'unit': kg.id,
'quantity': 1,
'from_location': supplier.id,
'to_location': storage.id,
@@ -129,7 +129,7 @@ class StockTestCase(
'currency': currency.id,
}, {
'product': product.id,
- 'uom': kg.id,
+ 'unit': kg.id,
'quantity': 1,
'from_location': storage.id,
'to_location': customer.id,
@@ -140,7 +140,7 @@ class StockTestCase(
'currency': currency.id,
}, {
'product': product.id,
- 'uom': kg.id,
+ 'unit': kg.id,
'quantity': 1,
'from_location': storage.id,
'to_location': customer.id,
@@ -150,7 +150,7 @@ class StockTestCase(
'currency': currency.id,
}, {
'product': product.id,
- 'uom': kg.id,
+ 'unit': kg.id,
'quantity': 2,
'from_location': storage.id,
'to_location': customer.id,
@@ -160,7 +160,7 @@ class StockTestCase(
'currency': currency.id,
}, {
'product': product.id,
- 'uom': kg.id,
+ 'unit': kg.id,
'quantity': 5,
'from_location': supplier.id,
'to_location': storage.id,
@@ -340,7 +340,7 @@ class StockTestCase(
moves = Move.create([{
'product': product.id,
- 'uom': g.id,
+ 'unit': g.id,
'quantity': 1,
'from_location': supplier.id,
'to_location': storage.id,
@@ -408,7 +408,7 @@ class StockTestCase(
moves = Move.create([{
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 1,
'from_location': lost_found.id,
'to_location': storage.id,
@@ -417,7 +417,7 @@ class StockTestCase(
'company': company.id,
}, {
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 1,
'from_location': input_.id,
'to_location': storage.id,
@@ -508,7 +508,7 @@ class StockTestCase(
moves = Move.create([{
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 1,
'from_location': lost_found.id,
'to_location': storage.id,
@@ -517,7 +517,7 @@ class StockTestCase(
'company': company.id,
}, {
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 1,
'from_location': lost_found.id,
'to_location': storage1.id,
@@ -526,7 +526,7 @@ class StockTestCase(
'company': company.id,
}, {
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 1,
'from_location': storage1.id,
'to_location': storage2.id,
@@ -618,7 +618,7 @@ class StockTestCase(
moves = Move.create([{
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 80,
'from_location': supplier.id,
'to_location': storage.id,
@@ -628,7 +628,7 @@ class StockTestCase(
'currency': company.currency.id,
}, {
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 60,
'from_location': storage.id,
'to_location': storage2.id,
@@ -694,7 +694,7 @@ class StockTestCase(
moves = Move.create([{
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 10,
'from_location': lost_found.id,
'to_location': storage.id,
@@ -702,7 +702,7 @@ class StockTestCase(
'company': company.id,
}, {
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 2,
'from_location': storage.id,
'to_location': output.id,
@@ -710,7 +710,7 @@ class StockTestCase(
'company': company.id,
}, {
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 3,
'from_location': storage.id,
'to_location': output.id,
@@ -766,7 +766,7 @@ class StockTestCase(
moves = Move.create([{
'product': product1.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 2,
'from_location': lost_found.id,
'to_location': storage.id,
@@ -775,7 +775,7 @@ class StockTestCase(
'company': company.id,
}, {
'product': product2.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 3,
'from_location': input_.id,
'to_location': storage.id,
@@ -836,7 +836,7 @@ class StockTestCase(
moves = Move.create([{
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 10,
'from_location': supplier.id,
'to_location': storage.id,
@@ -847,7 +847,7 @@ class StockTestCase(
'currency': currency.id,
}, {
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 15,
'from_location': supplier.id,
'to_location': storage.id,
@@ -858,7 +858,7 @@ class StockTestCase(
'currency': currency.id,
}, {
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 5,
'from_location': storage.id,
'to_location': customer.id,
@@ -871,7 +871,7 @@ class StockTestCase(
Move.do(moves)
Move.create([{
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 3,
'from_location': supplier.id,
'to_location': storage.id,
@@ -938,7 +938,7 @@ class StockTestCase(
# Test check_period_closed
moves = Move.create([{
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 10,
'from_location': supplier.id,
'to_location': storage.id,
@@ -952,7 +952,7 @@ class StockTestCase(
self.assertRaises(Exception, Move.create, [{
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 10,
'from_location': supplier.id,
'to_location': storage.id,
@@ -964,7 +964,7 @@ class StockTestCase(
}])
self.assertRaises(Exception, Move.create, [{
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 10,
'from_location': supplier.id,
'to_location': storage.id,
@@ -998,11 +998,11 @@ class StockTestCase(
Location = pool.get('stock.location')
Move = pool.get('stock.move')
- uom, = Uom.search([('name', '=', 'Unit')])
+ unit, = Uom.search([('name', '=', 'Unit')])
template, = Template.create([{
'name': 'Test Move.check_origin',
'type': 'goods',
- 'default_uom': uom.id,
+ 'default_uom': unit.id,
}])
product, = Product.create([{
'template': template.id,
@@ -1013,7 +1013,7 @@ class StockTestCase(
with set_company(company):
moves = Move.create([{
'product': product.id,
- 'uom': uom.id,
+ 'unit': unit.id,
'quantity': 1,
'from_location': storage.id,
'to_location': customer.id,
@@ -1047,11 +1047,11 @@ class StockTestCase(
Location = pool.get('stock.location')
Move = pool.get('stock.move')
- uom, = Uom.search([('name', '=', 'Meter')])
+ unit, = Uom.search([('name', '=', 'Meter')])
template = Template(
name='Test Move.assign_try',
type='goods',
- default_uom=uom,
+ default_uom=unit,
)
template.save()
product = Product(template=template.id)
@@ -1065,7 +1065,7 @@ class StockTestCase(
with set_company(company):
move, = Move.create([{
'product': product.id,
- 'uom': uom.id,
+ 'unit': unit.id,
'quantity': quantity,
'from_location': supplier.id,
'to_location': storage.id,
@@ -1077,7 +1077,7 @@ class StockTestCase(
moves = Move.create([{
'product': product.id,
- 'uom': uom.id,
+ 'unit': unit.id,
'quantity': qty,
'from_location': storage.id,
'to_location': customer.id,
@@ -1111,11 +1111,11 @@ class StockTestCase(
Location = pool.get('stock.location')
Move = pool.get('stock.move')
- uom, = Uom.search([('name', '=', 'Meter')])
+ unit, = Uom.search([('name', '=', 'Meter')])
template = Template(
name='Test Move.assign_try',
type='goods',
- default_uom=uom,
+ default_uom=unit,
)
template.save()
product = Product(template=template.id)
@@ -1130,7 +1130,7 @@ class StockTestCase(
with set_company(company):
move, = Move.create([{
'product': product.id,
- 'uom': uom.id,
+ 'unit': unit.id,
'quantity': 1,
'from_location': supplier.id,
'to_location': storage.id,
@@ -1142,7 +1142,7 @@ class StockTestCase(
moves = Move.create([{
'product': product.id,
- 'uom': uom.id,
+ 'unit': unit.id,
'quantity': 1,
'from_location': from_.id,
'to_location': to.id,
@@ -1166,11 +1166,11 @@ class StockTestCase(
Location = pool.get('stock.location')
Move = pool.get('stock.move')
- uom, = Uom.search([('name', '=', 'Meter')])
+ unit, = Uom.search([('name', '=', 'Meter')])
template = Template(
name='Test Move.assign_try',
type='goods',
- default_uom=uom,
+ default_uom=unit,
)
template.save()
product = Product(template=template.id)
@@ -1184,7 +1184,7 @@ class StockTestCase(
with set_company(company):
move, = Move.create([{
'product': product.id,
- 'uom': uom.id,
+ 'unit': unit.id,
'quantity': 1,
'from_location': supplier.id,
'to_location': child.id,
@@ -1196,7 +1196,7 @@ class StockTestCase(
move, = Move.create([{
'product': product.id,
- 'uom': uom.id,
+ 'unit': unit.id,
'quantity': 1,
'from_location': storage.id,
'to_location': child.id,
@@ -1218,11 +1218,11 @@ class StockTestCase(
Location = pool.get('stock.location')
Move = pool.get('stock.move')
- uom, = Uom.search([('name', '=', 'Meter')])
+ unit, = Uom.search([('name', '=', 'Meter')])
template = Template(
name='Test Move.assign_try',
type='goods',
- default_uom=uom,
+ default_uom=unit,
)
template.save()
product = Product(template=template.id)
@@ -1239,7 +1239,7 @@ class StockTestCase(
with set_company(company):
moves = Move.create([{
'product': product.id,
- 'uom': uom.id,
+ 'unit': unit.id,
'quantity': 1,
'from_location': supplier.id,
'to_location': storage.id,
@@ -1248,7 +1248,7 @@ class StockTestCase(
'currency': company.currency.id,
}, {
'product': product.id,
- 'uom': uom.id,
+ 'unit': unit.id,
'quantity': 1,
'from_location': supplier.id,
'to_location': storage2.id,
@@ -1260,7 +1260,7 @@ class StockTestCase(
move, = Move.create([{
'product': product.id,
- 'uom': uom.id,
+ 'unit': unit.id,
'quantity': 1,
'from_location': storage.id,
'to_location': customer.id,
@@ -1292,11 +1292,11 @@ class StockTestCase(
Location = pool.get('stock.location')
Move = pool.get('stock.move')
- uom, = Uom.search([('name', '=', 'Meter')])
+ unit, = Uom.search([('name', '=', 'Meter')])
template = Template(
name='Test Move.assign_try',
type='goods',
- default_uom=uom,
+ default_uom=unit,
)
template.save()
product = Product(template=template.id)
@@ -1311,7 +1311,7 @@ class StockTestCase(
with set_company(company):
move, = Move.create([{
'product': product.id,
- 'uom': uom.id,
+ 'unit': unit.id,
'quantity': 1,
'from_location': supplier.id,
'to_location': storage.id,
@@ -1323,7 +1323,7 @@ class StockTestCase(
move, = Move.create([{
'product': product.id,
- 'uom': uom.id,
+ 'unit': unit.id,
'quantity': 2,
'from_location': storage2.id,
'to_location': customer.id,
@@ -1379,7 +1379,7 @@ class StockTestCase(
with set_company(company):
move_supplier, = Move.create([{
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 10,
'from_location': supplier.id,
'to_location': storage.id,
@@ -1390,7 +1390,7 @@ class StockTestCase(
}])
move_customer, = Move.create([{
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 5,
'from_location': storage.id,
'to_location': customer.id,
@@ -1489,7 +1489,7 @@ class StockTestCase(
moves = Move.create([{
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 1,
'from_location': storage.id,
'to_location': location.id,
@@ -1527,14 +1527,14 @@ class StockTestCase(
with set_company(company):
Move.create([{
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 1,
'from_location': storage.id,
'to_location': location.id,
'company': company.id,
}, {
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 1,
'from_location': location.id,
'to_location': storage.id,
@@ -1569,7 +1569,7 @@ class StockTestCase(
with set_company(company):
Move.create([{
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 1,
'from_location': supplier.id,
'to_location': storage.id,
@@ -1578,7 +1578,7 @@ class StockTestCase(
'company': company.id,
}, {
'product': product2.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 1,
'from_location': supplier.id,
'to_location': storage.id,
@@ -1591,7 +1591,7 @@ class StockTestCase(
Move.create([{
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 1,
'from_location': storage.id,
'to_location': supplier.id,
@@ -1600,7 +1600,7 @@ class StockTestCase(
'company': company.id,
}, {
'product': product2.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 1,
'from_location': storage.id,
'to_location': supplier.id,
@@ -1635,7 +1635,7 @@ class StockTestCase(
with set_company(company):
Move.create([{
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 1,
'from_location': supplier.id,
'to_location': storage.id,
@@ -1648,7 +1648,7 @@ class StockTestCase(
Move.create([{
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 1,
'from_location': storage.id,
'to_location': supplier.id,
@@ -1687,7 +1687,7 @@ class StockTestCase(
moves = Move.create([{
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 1,
'from_location': lost_found.id,
'to_location': storage.id,
diff --git a/modules/stock/view/inventory_count_quantity_form.xml b/modules/stock/view/inventory_count_quantity_form.xml
index 7df3362597..355e7ba993 100644
--- a/modules/stock/view/inventory_count_quantity_form.xml
+++ b/modules/stock/view/inventory_count_quantity_form.xml
@@ -5,8 +5,8 @@ this repository contains the full copyright notices and license terms. -->
-
+
-
+
diff --git a/modules/stock/view/inventory_line_form.xml b/modules/stock/view/inventory_line_form.xml
index b091b886f5..e06b00bc85 100644
--- a/modules/stock/view/inventory_line_form.xml
+++ b/modules/stock/view/inventory_line_form.xml
@@ -10,9 +10,9 @@ this repository contains the full copyright notices and license terms. -->
-
+
-
+
diff --git a/modules/stock/view/inventory_line_list_simple.xml b/modules/stock/view/inventory_line_list_simple.xml
index 8d6fb81f6b..ebe62380b9 100644
--- a/modules/stock/view/inventory_line_list_simple.xml
+++ b/modules/stock/view/inventory_line_list_simple.xml
@@ -3,6 +3,6 @@
this repository contains the full copyright notices and license terms. -->
-
-
+
+
diff --git a/modules/stock/view/inventory_line_tree.xml b/modules/stock/view/inventory_line_tree.xml
index 3624e82dee..23a0955a34 100644
--- a/modules/stock/view/inventory_line_tree.xml
+++ b/modules/stock/view/inventory_line_tree.xml
@@ -6,6 +6,6 @@ this repository contains the full copyright notices and license terms. -->
-
-
+
+
diff --git a/modules/stock/view/move_form.xml b/modules/stock/view/move_form.xml
index 13bf10ff6a..3d3b49c0de 100644
--- a/modules/stock/view/move_form.xml
+++ b/modules/stock/view/move_form.xml
@@ -15,8 +15,8 @@ this repository contains the full copyright notices and license terms. -->
-
-
+
+
diff --git a/modules/stock/view/move_list_shipment.xml b/modules/stock/view/move_list_shipment.xml
index 660bf4b2e4..1556beff43 100644
--- a/modules/stock/view/move_list_shipment.xml
+++ b/modules/stock/view/move_list_shipment.xml
@@ -5,7 +5,7 @@ this repository contains the full copyright notices and license terms. -->
-
+
diff --git a/modules/stock/view/move_list_shipment_in.xml b/modules/stock/view/move_list_shipment_in.xml
index 6d1260fbeb..919af93e52 100644
--- a/modules/stock/view/move_list_shipment_in.xml
+++ b/modules/stock/view/move_list_shipment_in.xml
@@ -6,7 +6,7 @@ this repository contains the full copyright notices and license terms. -->
-
+
diff --git a/modules/stock/view/move_tree.xml b/modules/stock/view/move_tree.xml
index 14ab665139..7b4ac9cc15 100644
--- a/modules/stock/view/move_tree.xml
+++ b/modules/stock/view/move_tree.xml
@@ -7,7 +7,7 @@ this repository contains the full copyright notices and license terms. -->
-
+
diff --git a/modules/stock/view/move_tree_simple.xml b/modules/stock/view/move_tree_simple.xml
index a0a4dd1dec..d0da23231b 100644
--- a/modules/stock/view/move_tree_simple.xml
+++ b/modules/stock/view/move_tree_simple.xml
@@ -3,5 +3,5 @@
this repository contains the full copyright notices and license terms. -->
-
+
diff --git a/modules/stock_assign_manual/stock.py b/modules/stock_assign_manual/stock.py
index 393a406cf1..84ef9cbaa3 100644
--- a/modules/stock_assign_manual/stock.py
+++ b/modules/stock_assign_manual/stock.py
@@ -148,7 +148,7 @@ class ShipmentAssignManual(Wizard):
if 'move' in fields:
defaults['move'] = self.show.move.id
if 'unit' in fields:
- defaults['unit'] = self.show.move.uom.id
+ defaults['unit'] = self.show.move.unit.id
if 'move_quantity' in fields:
defaults['move_quantity'] = self.show.move.quantity
return defaults
@@ -286,8 +286,8 @@ class ShipmentAssignManualShow(ModelView):
'stock_assign_manual.msg_invalid_quantity',
quantity=lang.format_number(
self.move_quantity, uom.digits)))
- quantity = self.move.uom.round(self.quantity)
- remainder = self.move.uom.round(self.move.quantity - quantity)
+ quantity = self.move.unit.round(self.quantity)
+ remainder = self.move.unit.round(self.move.quantity - quantity)
self.move.quantity = quantity
self.move.save()
if remainder:
@@ -408,7 +408,7 @@ class ShipmentAssignedMove(ModelView):
@fields.depends('move')
def on_change_with_unit(self, name=None):
- return self.move.uom if self.move else None
+ return self.move.unit if self.move else None
@fields.depends('move')
def on_change_with_move_quantity(self, name=None):
diff --git a/modules/stock_assign_manual/tests/scenario_stock_assign_manual.rst b/modules/stock_assign_manual/tests/scenario_stock_assign_manual.rst
index d80e6e0bfb..9b39ddae4b 100644
--- a/modules/stock_assign_manual/tests/scenario_stock_assign_manual.rst
+++ b/modules/stock_assign_manual/tests/scenario_stock_assign_manual.rst
@@ -78,7 +78,7 @@ Make a customer shipment::
>>> shipment.customer = customer
>>> move = shipment.outgoing_moves.new()
>>> move.product = product
- >>> move.uom = unit
+ >>> move.unit = unit
>>> move.quantity = 2
>>> move.from_location = output_loc
>>> move.to_location = customer_loc
@@ -86,7 +86,7 @@ Make a customer shipment::
>>> move.currency = company.currency
>>> move = shipment.outgoing_moves.new()
>>> move.product = product
- >>> move.uom = unit
+ >>> move.unit = unit
>>> move.quantity = 3
>>> move.from_location = output_loc
>>> move.to_location = customer_loc
diff --git a/modules/stock_consignment/stock.py b/modules/stock_consignment/stock.py
index ef57e4e048..cbb3a13162 100644
--- a/modules/stock_consignment/stock.py
+++ b/modules/stock_consignment/stock.py
@@ -187,7 +187,7 @@ class Move(metaclass=PoolMeta):
line.currency = currency
line.product = self.product
line.quantity = self.quantity
- line.unit = self.uom
+ line.unit = self.unit
line.stock_moves = [self]
line.origin = self
line.on_change_product()
@@ -214,7 +214,7 @@ class Move(metaclass=PoolMeta):
line.currency = self.company.currency
line.product = self.product
line.quantity = self.quantity
- line.unit = self.uom
+ line.unit = self.unit
line.stock_moves = [self]
line.origin = self
line.on_change_product()
diff --git a/modules/stock_forecast/forecast.py b/modules/stock_forecast/forecast.py
index ab54f0f4c5..d0741bd6b4 100644
--- a/modules/stock_forecast/forecast.py
+++ b/modules/stock_forecast/forecast.py
@@ -467,7 +467,7 @@ class ForecastLine(ModelSQL, ModelView):
move.from_location = self.forecast.warehouse.storage_location
move.to_location = self.forecast.destination
move.product = self.product
- move.uom = self.uom
+ move.unit = self.uom
move.quantity = qty * self.minimal_quantity
move.planned_date = from_date + datetime.timedelta(day)
move.company = self.forecast.company
diff --git a/modules/stock_forecast/tests/test_module.py b/modules/stock_forecast/tests/test_module.py
index 8b667424c4..b2f010b624 100644
--- a/modules/stock_forecast/tests/test_module.py
+++ b/modules/stock_forecast/tests/test_module.py
@@ -119,7 +119,7 @@ class StockForecastTestCase(CompanyTestMixin, ModuleTestCase):
'from_location': storage.id,
'to_location': customer.id,
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 2,
'planned_date': today + relativedelta(months=1, day=5),
'company': company.id,
@@ -198,7 +198,7 @@ class StockForecastTestCase(CompanyTestMixin, ModuleTestCase):
'from_location': storage.id,
'to_location': customer.id,
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 10,
'planned_date': today - relativedelta(days=5),
'company': company.id,
@@ -297,7 +297,7 @@ class StockForecastTestCase(CompanyTestMixin, ModuleTestCase):
'from_location': supplier.id,
'to_location': storage.id,
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 10,
'effective_date': (today
+ relativedelta(months=-1, day=1)),
@@ -308,7 +308,7 @@ class StockForecastTestCase(CompanyTestMixin, ModuleTestCase):
'from_location': storage.id,
'to_location': customer.id,
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 5,
'effective_date': (today
+ relativedelta(months=-1, day=15)),
diff --git a/modules/stock_lot/stock.py b/modules/stock_lot/stock.py
index be319c8dea..c15b0f22d8 100644
--- a/modules/stock_lot/stock.py
+++ b/modules/stock_lot/stock.py
@@ -222,7 +222,7 @@ class LotTrace(ModelSQL, ModelView):
move.product.as_('product'),
move.lot.as_('lot'),
move.quantity.as_('quantity'),
- move.uom.as_('unit'),
+ move.unit.as_('unit'),
move.company.as_('company'),
move.effective_date.as_('date'),
move.shipment.as_('shipment'),
@@ -487,7 +487,7 @@ class MoveAddLots(Wizard):
if 'quantity' in fields:
default['quantity'] = self.record.quantity
if 'unit' in fields:
- default['unit'] = self.record.uom.id
+ default['unit'] = self.record.unit.id
return default
def transition_add(self):
@@ -497,7 +497,7 @@ class MoveAddLots(Wizard):
lang = Lang.get()
quantity_remaining = self.start.on_change_with_quantity_remaining()
if quantity_remaining < 0:
- digits = self.record.uom.digits
+ digits = self.record.unit.digits
move_quantity = self.record.quantity
lot_quantity = self.record.quantity - quantity_remaining
raise ValidationError(gettext(
diff --git a/modules/stock_lot/tests/scenario_stock_lot_assign_try.rst b/modules/stock_lot/tests/scenario_stock_lot_assign_try.rst
index 42f8df6a3f..72994c2c66 100644
--- a/modules/stock_lot/tests/scenario_stock_lot_assign_try.rst
+++ b/modules/stock_lot/tests/scenario_stock_lot_assign_try.rst
@@ -97,7 +97,7 @@ Create shipment out::
>>> shipment.company = company
>>> move = shipment.outgoing_moves.new()
>>> move.product = product
- >>> move.uom = unit
+ >>> move.unit = unit
>>> move.quantity = 10
>>> move.from_location = output_loc
>>> move.to_location = customer_loc
diff --git a/modules/stock_lot/tests/scenario_stock_lot_shipment_out.rst b/modules/stock_lot/tests/scenario_stock_lot_shipment_out.rst
index 4e2274ac5c..e8997d6ec2 100644
--- a/modules/stock_lot/tests/scenario_stock_lot_shipment_out.rst
+++ b/modules/stock_lot/tests/scenario_stock_lot_shipment_out.rst
@@ -62,7 +62,7 @@ Create Shipment Out::
>>> shipment_out.company = company
>>> move = shipment_out.outgoing_moves.new()
>>> move.product = product
- >>> move.uom =unit
+ >>> move.unit =unit
>>> move.quantity = 10
>>> move.from_location = output_loc
>>> move.to_location = customer_loc
diff --git a/modules/stock_lot/tests/test_module.py b/modules/stock_lot/tests/test_module.py
index 0c8c73e309..0f5e93b360 100644
--- a/modules/stock_lot/tests/test_module.py
+++ b/modules/stock_lot/tests/test_module.py
@@ -53,7 +53,7 @@ class StockLotTestCase(CompanyTestMixin, ModuleTestCase):
moves = Move.create([{
'product': product.id,
'lot': lot1.id,
- 'uom': kg.id,
+ 'unit': kg.id,
'quantity': 5,
'from_location': supplier.id,
'to_location': storage.id,
@@ -63,7 +63,7 @@ class StockLotTestCase(CompanyTestMixin, ModuleTestCase):
}, {
'product': product.id,
'lot': lot2.id,
- 'uom': kg.id,
+ 'unit': kg.id,
'quantity': 10,
'from_location': supplier.id,
'to_location': storage.id,
@@ -73,7 +73,7 @@ class StockLotTestCase(CompanyTestMixin, ModuleTestCase):
}, {
'product': product.id,
'lot': lot2.id,
- 'uom': kg.id,
+ 'unit': kg.id,
'quantity': 2,
'from_location': storage.id,
'to_location': customer.id,
@@ -83,7 +83,7 @@ class StockLotTestCase(CompanyTestMixin, ModuleTestCase):
}, {
'product': product.id,
'lot': None,
- 'uom': kg.id,
+ 'unit': kg.id,
'quantity': 3,
'from_location': supplier.id,
'to_location': storage.id,
@@ -148,7 +148,7 @@ class StockLotTestCase(CompanyTestMixin, ModuleTestCase):
moves = Move.create([{
'product': product.id,
'lot': lot1.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 5,
'from_location': supplier.id,
'to_location': storage.id,
@@ -160,7 +160,7 @@ class StockLotTestCase(CompanyTestMixin, ModuleTestCase):
}, {
'product': product.id,
'lot': lot2.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 10,
'from_location': supplier.id,
'to_location': storage.id,
@@ -172,7 +172,7 @@ class StockLotTestCase(CompanyTestMixin, ModuleTestCase):
}, {
'product': product.id,
'lot': None,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': 3,
'from_location': supplier.id,
'to_location': storage.id,
@@ -224,11 +224,11 @@ class StockLotTestCase(CompanyTestMixin, ModuleTestCase):
Move = pool.get('stock.move')
Lot = pool.get('stock.lot')
- uom, = Uom.search([('name', '=', 'Meter')])
+ unit, = Uom.search([('name', '=', 'Meter')])
template = Template(
name="Product",
type='goods',
- default_uom=uom,
+ default_uom=unit,
)
template.save()
product = Product(template=template.id)
@@ -250,7 +250,7 @@ class StockLotTestCase(CompanyTestMixin, ModuleTestCase):
moves = Move.create([{
'product': product.id,
'lot': lot1.id,
- 'uom': uom.id,
+ 'unit': unit.id,
'quantity': 2,
'from_location': supplier.id,
'to_location': storage.id,
@@ -260,7 +260,7 @@ class StockLotTestCase(CompanyTestMixin, ModuleTestCase):
}, {
'product': product.id,
'lot': lot2.id,
- 'uom': uom.id,
+ 'unit': unit.id,
'quantity': 3,
'from_location': supplier.id,
'to_location': storage.id,
@@ -270,7 +270,7 @@ class StockLotTestCase(CompanyTestMixin, ModuleTestCase):
}, {
'product': product.id,
'lot': None,
- 'uom': uom.id,
+ 'unit': unit.id,
'quantity': 3,
'from_location': supplier.id,
'to_location': storage.id,
@@ -282,7 +282,7 @@ class StockLotTestCase(CompanyTestMixin, ModuleTestCase):
move, = Move.create([{
'product': product.id,
- 'uom': uom.id,
+ 'unit': unit.id,
'quantity': 10,
'from_location': storage.id,
'to_location': customer.id,
diff --git a/modules/stock_lot_sled/tests/test_module.py b/modules/stock_lot_sled/tests/test_module.py
index 9464ff3c3c..32094e18d9 100644
--- a/modules/stock_lot_sled/tests/test_module.py
+++ b/modules/stock_lot_sled/tests/test_module.py
@@ -55,7 +55,7 @@ class StockLotSLEDTestCase(CompanyTestMixin, ModuleTestCase):
move = Move(
product=product,
- uom=u,
+ unit=u,
quantity=5,
from_location=supplier,
to_location=storage,
diff --git a/modules/stock_lot_unit/stock.py b/modules/stock_lot_unit/stock.py
index 32e35ef965..9065afaa84 100644
--- a/modules/stock_lot_unit/stock.py
+++ b/modules/stock_lot_unit/stock.py
@@ -100,7 +100,7 @@ class Move(metaclass=PoolMeta):
and self.lot
and self.lot.unit):
quantity = UoM.compute_qty(
- self.uom, self.quantity,
+ self.unit, self.quantity,
self.lot.unit, round=False)
if quantity > self.lot.unit_quantity:
raise LotUnitQuantityError(
@@ -169,7 +169,7 @@ class LotUnitMixin(object):
if not move.lot or not move.lot.unit:
continue
lot_quantities[move.lot] += UoM.compute_qty(
- move.uom, move.quantity,
+ move.unit, move.quantity,
move.lot.unit, round=False)
for lot, quantity in lot_quantities.items():
if quantity > lot.unit_quantity:
diff --git a/modules/stock_package/tests/scenario_stock_package.rst b/modules/stock_package/tests/scenario_stock_package.rst
index 75b9f54c7e..460c51048a 100644
--- a/modules/stock_package/tests/scenario_stock_package.rst
+++ b/modules/stock_package/tests/scenario_stock_package.rst
@@ -67,7 +67,7 @@ Add two shipment lines of same product::
>>> shipment_out.outgoing_moves.extend([StockMove(), StockMove()])
>>> for move in shipment_out.outgoing_moves:
... move.product = product
- ... move.uom =unit
+ ... move.unit =unit
... move.quantity = 1
... move.from_location = output_loc
... move.to_location = customer_loc
diff --git a/modules/stock_secondary_unit/stock.py b/modules/stock_secondary_unit/stock.py
index 6143933c8b..cd1568a2fc 100644
--- a/modules/stock_secondary_unit/stock.py
+++ b/modules/stock_secondary_unit/stock.py
@@ -42,52 +42,52 @@ class Move(metaclass=PoolMeta):
'product.uom.category', "Product Secondary UOM Category"),
'get_product_secondary_uom_category')
- @fields.depends('quantity', 'uom', 'secondary_unit', 'origin')
+ @fields.depends('quantity', 'unit', 'secondary_unit', 'origin')
def on_change_with_secondary_quantity(self, name=None):
pool = Pool()
Uom = pool.get('product.uom')
- if (self.quantity and self.uom and self.secondary_unit
+ if (self.quantity and self.unit and self.secondary_unit
and (self.secondary_uom_factor or self.secondary_uom_rate)):
return Uom.compute_qty(
- self.uom, self.quantity,
+ self.unit, self.quantity,
self.secondary_unit, round=True,
factor=self.secondary_uom_factor, rate=self.secondary_uom_rate)
else:
return None
- @fields.depends('secondary_quantity', 'secondary_unit', 'uom', 'origin')
+ @fields.depends('secondary_quantity', 'secondary_unit', 'unit', 'origin')
def on_change_secondary_quantity(self):
pool = Pool()
Uom = pool.get('product.uom')
- if (self.secondary_quantity and self.secondary_unit and self.uom
+ if (self.secondary_quantity and self.secondary_unit and self.unit
and (self.secondary_uom_factor or self.secondary_uom_rate)):
self.quantity = Uom.compute_qty(
self.secondary_unit, self.secondary_quantity,
- self.uom, round=True,
+ self.unit, round=True,
factor=self.secondary_uom_rate, rate=self.secondary_uom_factor)
- @fields.depends('unit_price', 'uom', 'secondary_unit', 'origin')
+ @fields.depends('unit_price', 'unit', 'secondary_unit', 'origin')
def on_change_with_secondary_unit_price(self, name=None):
pool = Pool()
Uom = pool.get('product.uom')
- if (self.unit_price and self.uom and self.secondary_unit
+ if (self.unit_price and self.unit and self.secondary_unit
and (self.secondary_uom_factor or self.secondary_uom_rate)):
unit_price = Uom.compute_price(
- self.uom, self.unit_price, self.secondary_unit,
+ self.unit, self.unit_price, self.secondary_unit,
factor=self.secondary_uom_factor, rate=self.secondary_uom_rate
)
return round_price(unit_price)
else:
return None
- @fields.depends('secondary_unit_price', 'secondary_unit', 'uom', 'origin')
+ @fields.depends('secondary_unit_price', 'secondary_unit', 'unit', 'origin')
def on_change_secondary_unit_price(self, name=None):
pool = Pool()
Uom = pool.get('product.uom')
- if (self.secondary_unit_price and self.secondary_unit and self.uom
+ if (self.secondary_unit_price and self.secondary_unit and self.unit
and (self.secondary_uom_factor or self.secondary_uom_rate)):
self.unit_price = Uom.compute_price(
- self.secondary_unit, self.secondary_unit_price, self.uom,
+ self.secondary_unit, self.secondary_unit_price, self.unit,
factor=self.secondary_uom_rate, rate=self.secondary_uom_factor)
self.unit_price = round_price(self.unit_price)
diff --git a/modules/stock_shipment_measurements/stock.py b/modules/stock_shipment_measurements/stock.py
index fe815e5c2b..3ff40563f2 100644
--- a/modules/stock_shipment_measurements/stock.py
+++ b/modules/stock_shipment_measurements/stock.py
@@ -81,7 +81,7 @@ class Move(metaclass=PoolMeta):
help="The volume of the moved product in liter.")
@classmethod
- def _get_internal_weight(cls, quantity, uom, product):
+ def _get_internal_weight(cls, quantity, unit, product):
pool = Pool()
Uom = pool.get('product.uom')
ModelData = pool.get('ir.model.data')
@@ -92,17 +92,17 @@ class Move(metaclass=PoolMeta):
# as it could include some handling weight
if product.weight is not None:
internal_quantity = cls._get_internal_quantity(
- quantity, uom, product)
+ quantity, unit, product)
return Uom.compute_qty(
product.weight_uom, internal_quantity * product.weight, kg,
round=False)
- elif uom.category == kg.category:
- return Uom.compute_qty(uom, quantity, kg, round=False)
+ elif unit.category == kg.category:
+ return Uom.compute_qty(unit, quantity, kg, round=False)
else:
return None
@classmethod
- def _get_internal_volume(cls, quantity, uom, product):
+ def _get_internal_volume(cls, quantity, unit, product):
pool = Pool()
Uom = pool.get('product.uom')
ModelData = pool.get('ir.model.data')
@@ -113,12 +113,12 @@ class Move(metaclass=PoolMeta):
# as it could include some handling volume
if product.volume is not None:
internal_quantity = cls._get_internal_quantity(
- quantity, uom, product)
+ quantity, unit, product)
return Uom.compute_qty(
product.volume_uom, internal_quantity * product.volume, liter,
round=False)
- elif uom.category == liter.category:
- return Uom.compute_qty(uom, quantity, liter, round=False)
+ elif unit.category == liter.category:
+ return Uom.compute_qty(unit, quantity, liter, round=False)
else:
return None
@@ -131,12 +131,12 @@ class Move(metaclass=PoolMeta):
vlist = [v.copy() for v in vlist]
for values in vlist:
product = Product(values['product'])
- uom = Uom(values['uom'])
+ unit = Uom(values['unit'])
quantity = values['quantity']
- internal_weight = cls._get_internal_weight(quantity, uom, product)
+ internal_weight = cls._get_internal_weight(quantity, unit, product)
if internal_weight is not None:
values['internal_weight'] = internal_weight
- internal_volume = cls._get_internal_volume(quantity, uom, product)
+ internal_volume = cls._get_internal_volume(quantity, unit, product)
if internal_volume is not None:
values['internal_volume'] = internal_volume
return super(Move, cls).create(vlist)
@@ -151,13 +151,13 @@ class Move(metaclass=PoolMeta):
for move in moves:
write = {}
internal_weight = cls._get_internal_weight(
- move.quantity, move.uom, move.product)
+ move.quantity, move.unit, move.product)
if (internal_weight is not None
and internal_weight != move.internal_weight
and internal_weight != values.get('internal_weight')):
write['internal_weight'] = internal_weight
internal_volume = cls._get_internal_volume(
- move.quantity, move.uom, move.product)
+ move.quantity, move.unit, move.product)
if (internal_volume is not None
and internal_volume != move.internal_volume
and internal_volume != values.get('internal_volume')):
diff --git a/modules/stock_shipment_measurements/tests/test_module.py b/modules/stock_shipment_measurements/tests/test_module.py
index a13282a792..5c31fa0487 100644
--- a/modules/stock_shipment_measurements/tests/test_module.py
+++ b/modules/stock_shipment_measurements/tests/test_module.py
@@ -52,7 +52,7 @@ class StockShipmentMeasurementsTestCase(CompanyTestMixin, ModuleTestCase):
with set_company(company):
move, = Move.create([{
'product': product,
- 'uom': g,
+ 'unit': g,
'quantity': 200,
'from_location': supplier,
'to_location': storage,
@@ -75,7 +75,7 @@ class StockShipmentMeasurementsTestCase(CompanyTestMixin, ModuleTestCase):
with set_company(company):
move, = Move.create([{
'product': product,
- 'uom': g,
+ 'unit': g,
'quantity': 300,
'from_location': supplier,
'to_location': storage,
@@ -98,7 +98,7 @@ class StockShipmentMeasurementsTestCase(CompanyTestMixin, ModuleTestCase):
with set_company(company):
move, = Move.create([{
'product': product,
- 'uom': g,
+ 'unit': g,
'quantity': 500,
'from_location': supplier,
'to_location': storage,
@@ -164,7 +164,7 @@ class StockShipmentMeasurementsTestCase(CompanyTestMixin, ModuleTestCase):
shipment.moves = [Move(
product=product,
- uom=kg,
+ unit=kg,
quantity=10,
from_location=storage,
to_location=customer,
diff --git a/modules/stock_split/stock.py b/modules/stock_split/stock.py
index d6c655ce3f..b2e97b3fcd 100644
--- a/modules/stock_split/stock.py
+++ b/modules/stock_split/stock.py
@@ -25,7 +25,7 @@ class Move(metaclass=PoolMeta):
def split_wizard(cls, moves):
pass
- def split(self, quantity, uom, count=None):
+ def split(self, quantity, unit, count=None):
"""
Split the move into moves of quantity.
If count is not defined, the move will be split until the remainder is
@@ -36,7 +36,7 @@ class Move(metaclass=PoolMeta):
Uom = pool.get('product.uom')
moves = [self]
- remainder = Uom.compute_qty(self.uom, self.quantity, uom)
+ remainder = Uom.compute_qty(self.unit, self.quantity, unit)
if remainder <= quantity:
return moves
state = self.state
@@ -45,7 +45,7 @@ class Move(metaclass=PoolMeta):
})
self.write([self], {
'quantity': quantity,
- 'uom': uom.id,
+ 'unit': unit.id,
})
remainder -= quantity
if count:
@@ -55,18 +55,18 @@ class Move(metaclass=PoolMeta):
with Transaction().set_context(_stock_move_split=True):
moves.extend(self.copy([self], {
'quantity': quantity,
- 'uom': uom.id,
+ 'unit': unit.id,
}))
remainder -= quantity
if count:
count -= 1
- remainder = uom.round(remainder)
+ remainder = unit.round(remainder)
assert remainder >= 0
if remainder:
with Transaction().set_context(_stock_move_split=True):
moves.extend(self.copy([self], {
'quantity': remainder,
- 'uom': uom.id,
+ 'unit': unit.id,
}))
self.write(moves, {
'state': state,
@@ -78,8 +78,9 @@ class SplitMoveStart(ModelView):
'Split Move'
__name__ = 'stock.move.split.start'
count = fields.Integer('Counts', help='The limit number of moves.')
- quantity = fields.Float("Quantity", digits='uom', required=True)
- uom = fields.Many2One('product.uom', 'Uom', required=True,
+ quantity = fields.Float("Quantity", digits='unit', required=True)
+ unit = fields.Many2One(
+ 'product.uom', "Unit", required=True,
domain=[
('category', '=', Eval('uom_category')),
])
@@ -99,13 +100,13 @@ class SplitMove(Wizard):
def default_start(self, fields):
return {
- 'uom': self.record.uom.id,
- 'uom_category': self.record.uom.category.id,
+ 'unit': self.record.unit.id,
+ 'uom_category': self.record.unit.category.id,
}
def transition_split(self):
self.record.split(
- self.start.quantity, self.start.uom, self.start.count)
+ self.start.quantity, self.start.unit, self.start.count)
return 'end'
diff --git a/modules/stock_split/tests/scenario_stock_split_shipment.rst b/modules/stock_split/tests/scenario_stock_split_shipment.rst
index f79afc0243..e02efa6ec0 100644
--- a/modules/stock_split/tests/scenario_stock_split_shipment.rst
+++ b/modules/stock_split/tests/scenario_stock_split_shipment.rst
@@ -58,7 +58,7 @@ Create shipment with 2 lines::
>>> for i in range(1, 3):
... move = shipment1.outgoing_moves.new()
... move.product = product
- ... move.uom = unit
+ ... move.unit = unit
... move.quantity = i
... move.from_location = output_loc
... move.to_location = customer_loc
diff --git a/modules/stock_split/tests/test_module.py b/modules/stock_split/tests/test_module.py
index c2c46a99eb..fe5c735db2 100644
--- a/modules/stock_split/tests/test_module.py
+++ b/modules/stock_split/tests/test_module.py
@@ -38,7 +38,7 @@ class StockSplitTestCase(CompanyTestMixin, ModuleTestCase):
def create_move(quantity):
move, = Move.create([{
'product': product.id,
- 'uom': unit.id,
+ 'unit': unit.id,
'quantity': quantity,
'from_location': input_.id,
'to_location': storage.id,
diff --git a/modules/stock_split/view/split_start_form.xml b/modules/stock_split/view/split_start_form.xml
index df7c25c065..12b5f75842 100644
--- a/modules/stock_split/view/split_start_form.xml
+++ b/modules/stock_split/view/split_start_form.xml
@@ -6,6 +6,6 @@ this repository contains the full copyright notices and license terms. -->
-
-
+
+
diff --git a/modules/stock_supply/shipment.py b/modules/stock_supply/shipment.py
index fda9402bde..186b6dc121 100644
--- a/modules/stock_supply/shipment.py
+++ b/modules/stock_supply/shipment.py
@@ -160,7 +160,7 @@ class ShipmentInternal(ModelSQL, ModelView):
planned_date=date,
product=product,
quantity=qty,
- uom=product.default_uom,
+ unit=product.default_uom,
company=company,
))
shipment.moves = shipment_moves
diff --git a/modules/stock_supply/tests/scenario_stock_supply_purchase_request.rst b/modules/stock_supply/tests/scenario_stock_supply_purchase_request.rst
index 43cfd5822f..759643a5f8 100644
--- a/modules/stock_supply/tests/scenario_stock_supply_purchase_request.rst
+++ b/modules/stock_supply/tests/scenario_stock_supply_purchase_request.rst
@@ -146,7 +146,7 @@ Create needs 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
diff --git a/modules/web_shop_vue_storefront/tests/test_module.py b/modules/web_shop_vue_storefront/tests/test_module.py
index a81282b030..c2b9b6cda3 100644
--- a/modules/web_shop_vue_storefront/tests/test_module.py
+++ b/modules/web_shop_vue_storefront/tests/test_module.py
@@ -95,7 +95,7 @@ class WebVueStorefrontTestCase(CompanyTestMixin, ModuleTestCase):
storage, = Location.search([('code', '=', 'STO')])
with set_company(web_shop.company):
move = Move(product=product)
- move.uom = unit
+ move.unit = unit
move.quantity = quantity
move.from_location = supplier
move.to_location = storage