odoo/addons/product/test/product_uom.yml

27 lines
921 B
YAML

-
In order to test conversation of UOM,
-
I convert Grams into TON with price.
-
!python {model: product.uom}: |
from_uom_id = ref("product_uom_gram")
to_uom_id = ref("product_uom_ton")
price = 2
qty = 1020000
price = self._compute_price(cr, uid, from_uom_id, price, to_uom_id)
qty = self._compute_qty(cr, uid, from_uom_id, qty, to_uom_id)
assert qty == 1.02, "Qty is not correspond."
assert price == 2000000.0, "Price is not correspond."
-
I convert Liters into Gallons with price.
-
!python {model: product.uom}: |
from_uom_id = ref("product_uom_litre")
to_uom_id = ref("product_uom_gal")
price = 2
qty = 30.28
price = self._compute_price(cr, uid, from_uom_id, price, to_uom_id)
qty = self._compute_qty(cr, uid, from_uom_id, qty, to_uom_id)
assert qty == 8, "Qty does not correspond."
assert round(price,2) == 7.57, "Price does not correspond."