Normalize Unit of Measure labels
For short label, we only use UoM with an help text showing with capital letter the meaning of UoM.
This commit is contained in:
@@ -2082,7 +2082,9 @@ class InvoiceLine(sequence_ordered(), ModelSQL, ModelView, TaxableMixin):
|
||||
},
|
||||
depends={'company'})
|
||||
product_uom_category = fields.Function(
|
||||
fields.Many2One('product.uom.category', 'Product Uom Category'),
|
||||
fields.Many2One(
|
||||
'product.uom.category', "Product UoM Category",
|
||||
help="The category of Unit of Measure for the product."),
|
||||
'on_change_with_product_uom_category')
|
||||
account = fields.Many2One('account.account', 'Account',
|
||||
ondelete='RESTRICT',
|
||||
|
||||
@@ -40,7 +40,8 @@ class InvoiceLine(metaclass=PoolMeta):
|
||||
|
||||
product_secondary_uom_category = fields.Function(
|
||||
fields.Many2One(
|
||||
'product.uom.category', "Product Secondary UOM Category"),
|
||||
'product.uom.category', "Product Secondary UoM Category",
|
||||
help="The category of secondary Unit of Measure for the product."),
|
||||
'get_product_secondary_uom_category')
|
||||
|
||||
@fields.depends('quantity', 'unit', 'secondary_unit', 'origin')
|
||||
|
||||
@@ -11,15 +11,16 @@ from trytond.transaction import Transaction
|
||||
|
||||
class Carrier(metaclass=PoolMeta):
|
||||
__name__ = 'carrier'
|
||||
weight_uom = fields.Many2One('product.uom', 'Weight Uom',
|
||||
weight_uom = fields.Many2One(
|
||||
'product.uom', "Weight UoM",
|
||||
domain=[('category', '=', Id('product', 'uom_cat_weight'))],
|
||||
states={
|
||||
'invisible': Eval('carrier_cost_method') != 'weight',
|
||||
'required': Eval('carrier_cost_method') == 'weight',
|
||||
'readonly': Bool(Eval('weight_price_list', [])),
|
||||
},
|
||||
help="The unit of weight criteria of the price list.")
|
||||
weight_uom_digits = fields.Function(fields.Integer('Weight Uom Digits'),
|
||||
help="The Unit of Measure of weight criteria for the price list.")
|
||||
weight_uom_digits = fields.Function(fields.Integer("Weight UoM Digits"),
|
||||
'on_change_with_weight_uom_digits')
|
||||
weight_currency = fields.Many2One('currency.currency', 'Currency',
|
||||
states={
|
||||
|
||||
@@ -179,11 +179,13 @@ class DutyRate(CountryMatchMixin, ModelSQL, ModelView):
|
||||
'required': Eval('computation_type').in_(['amount', 'quantity']),
|
||||
'invisible': ~Eval('computation_type').in_(['amount', 'quantity']),
|
||||
})
|
||||
uom = fields.Many2One('product.uom', 'Uom',
|
||||
uom = fields.Many2One(
|
||||
'product.uom', "UoM",
|
||||
states={
|
||||
'required': Eval('computation_type') == 'quantity',
|
||||
'invisible': Eval('computation_type') != 'quantity',
|
||||
})
|
||||
},
|
||||
help="The Unit of Measure.")
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
|
||||
@@ -4,22 +4,22 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data grouped="1">
|
||||
<record model="ir.message" id="msg_uom_modify_factor">
|
||||
<field name="text">You cannot modify the factor of UOM "%(uom)s".</field>
|
||||
<field name="text">You cannot modify the factor of the unit of measure "%(uom)s".</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_uom_modify_rate">
|
||||
<field name="text">You cannot modify the rate of UOM "%(uom)s".</field>
|
||||
<field name="text">You cannot modify the rate of the unit of measure"%(uom)s".</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_uom_modify_category">
|
||||
<field name="text">You cannot modify the category of UOM "%(uom)s".</field>
|
||||
<field name="text">You cannot modify the category of the unit of measure "%(uom)s".</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_uom_decrease_digits">
|
||||
<field name="text">You cannot decrease the digits of UOM "%(uom)s".</field>
|
||||
<field name="text">You cannot decrease the digits of the unit of measure "%(uom)s".</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_uom_modify_options">
|
||||
<field name="text">If the UOM is still not used, you can delete it otherwise you can deactivate it and create a new one.</field>
|
||||
<field name="text">If the unit of measure is still not used, you can delete it otherwise you can deactivate it and create a new one.</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_uom_incompatible_factor_rate">
|
||||
<field name="text">Incompatible factor and rate values on UOM "%(uom)s".</field>
|
||||
<field name="text">Incompatible factor and rate values on unit of measure"%(uom)s".</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_uom_no_zero_factor_rate">
|
||||
<field name="text">Rate and factor can not be both equal to zero.</field>
|
||||
|
||||
@@ -93,12 +93,15 @@ class Template(
|
||||
help="The method used to calculate the cost price."))
|
||||
cost_price_methods = fields.One2Many(
|
||||
'product.cost_price_method', 'template', "Cost Price Methods")
|
||||
default_uom = fields.Many2One('product.uom', "Default UOM", required=True,
|
||||
help="The standard unit of measure for the product.\n"
|
||||
default_uom = fields.Many2One(
|
||||
'product.uom', "Default UoM", required=True,
|
||||
help="The standard Unit of Measure for the product.\n"
|
||||
"Used internally when calculating the stock levels of goods "
|
||||
"and assets.")
|
||||
default_uom_category = fields.Function(
|
||||
fields.Many2One('product.uom.category', 'Default UOM Category'),
|
||||
fields.Many2One(
|
||||
'product.uom.category', "Default UoM Category",
|
||||
help="The category of the default Unit of Measure."),
|
||||
'on_change_with_default_uom_category',
|
||||
searcher='search_default_uom_category')
|
||||
categories = fields.Many2Many(
|
||||
|
||||
@@ -195,9 +195,9 @@ class Uom(SymbolMixin, DigitsMixin, DeactivableMixin, ModelSQL, ModelView):
|
||||
if not qty or (from_uom is None and to_uom is None):
|
||||
return qty
|
||||
if from_uom is None:
|
||||
raise ValueError("missing from_uom")
|
||||
raise ValueError("missing from_UoM")
|
||||
if to_uom is None:
|
||||
raise ValueError("missing to_uom")
|
||||
raise ValueError("missing to_UoM")
|
||||
if from_uom.category.id != to_uom.category.id:
|
||||
if not factor and not rate:
|
||||
raise ValueError(
|
||||
@@ -243,9 +243,9 @@ class Uom(SymbolMixin, DigitsMixin, DeactivableMixin, ModelSQL, ModelView):
|
||||
if not price or (from_uom is None and to_uom is None):
|
||||
return price
|
||||
if from_uom is None:
|
||||
raise ValueError("missing from_uom")
|
||||
raise ValueError("missing from_UoM")
|
||||
if to_uom is None:
|
||||
raise ValueError("missing to_uom")
|
||||
raise ValueError("missing to_UoM")
|
||||
if from_uom.category.id != to_uom.category.id:
|
||||
if not factor and not rate:
|
||||
raise ValueError(
|
||||
|
||||
@@ -15,37 +15,43 @@ class Template(metaclass=PoolMeta):
|
||||
states={
|
||||
'invisible': Eval('type').in_(NON_MEASURABLE),
|
||||
},
|
||||
help="Length for 1 default UOM.")
|
||||
length_uom = fields.Many2One('product.uom', 'Length UOM',
|
||||
help="Length for 1 default unit of measure.")
|
||||
length_uom = fields.Many2One(
|
||||
'product.uom', "Length UoM",
|
||||
domain=[('category', '=', Id('product', 'uom_cat_length'))],
|
||||
states={
|
||||
'invisible': Eval('type').in_(NON_MEASURABLE),
|
||||
'required': Bool(Eval('length')),
|
||||
})
|
||||
},
|
||||
help="The Unit of Measure for the length.")
|
||||
height = fields.Float(
|
||||
"Height", digits='height_uom',
|
||||
states={
|
||||
'invisible': Eval('type').in_(NON_MEASURABLE),
|
||||
},
|
||||
help="Height for 1 default UOM.")
|
||||
height_uom = fields.Many2One('product.uom', 'Height UOM',
|
||||
help="Height for 1 default unit of measure.")
|
||||
height_uom = fields.Many2One(
|
||||
'product.uom', 'Height UoM',
|
||||
domain=[('category', '=', Id('product', 'uom_cat_length'))],
|
||||
states={
|
||||
'invisible': Eval('type').in_(NON_MEASURABLE),
|
||||
'required': Bool(Eval('height')),
|
||||
})
|
||||
},
|
||||
help="The Unit of Measure for the height.")
|
||||
width = fields.Float(
|
||||
"Width", digits='width_uom',
|
||||
states={
|
||||
'invisible': Eval('type').in_(NON_MEASURABLE),
|
||||
},
|
||||
help="Width for 1 default UOM.")
|
||||
width_uom = fields.Many2One('product.uom', 'Width UOM',
|
||||
help="Width for 1 default unit of measure.")
|
||||
width_uom = fields.Many2One(
|
||||
'product.uom', 'Width UoM',
|
||||
domain=[('category', '=', Id('product', 'uom_cat_length'))],
|
||||
states={
|
||||
'invisible': Eval('type').in_(NON_MEASURABLE),
|
||||
'required': Bool(Eval('width')),
|
||||
})
|
||||
},
|
||||
help="The Unit of Measure for the width.")
|
||||
volume = fields.Float(
|
||||
"Volume", digits='volume_uom',
|
||||
states={
|
||||
@@ -53,25 +59,28 @@ class Template(metaclass=PoolMeta):
|
||||
'readonly': (Bool(Eval('length'))
|
||||
& Bool(Eval('height')) & Bool(Eval('width'))),
|
||||
},
|
||||
help="Volume for 1 default UOM.")
|
||||
volume_uom = fields.Many2One('product.uom', 'Volume UOM',
|
||||
help="Volume for 1 default unit of measure.")
|
||||
volume_uom = fields.Many2One(
|
||||
'product.uom', "Volume UoM",
|
||||
domain=[('category', '=', Id('product', 'uom_cat_volume'))],
|
||||
states={
|
||||
'invisible': Eval('type').in_(NON_MEASURABLE),
|
||||
'required': Bool(Eval('volume')),
|
||||
})
|
||||
},
|
||||
help="The Unit of Measure for the volume.")
|
||||
weight = fields.Float(
|
||||
"Weight", digits='weight_uom',
|
||||
states={
|
||||
'invisible': Eval('type').in_(NON_MEASURABLE),
|
||||
},
|
||||
help="Weight for 1 default UOM.")
|
||||
weight_uom = fields.Many2One('product.uom', 'Weight UOM',
|
||||
help="Weight for 1 default unit of measure.")
|
||||
weight_uom = fields.Many2One('product.uom', 'Weight UoM',
|
||||
domain=[('category', '=', Id('product', 'uom_cat_weight'))],
|
||||
states={
|
||||
'invisible': Eval('type').in_(NON_MEASURABLE),
|
||||
'required': Bool(Eval('weight')),
|
||||
})
|
||||
},
|
||||
help="The Unit of Measure for the weight.")
|
||||
|
||||
@fields.depends('volume', 'volume_uom',
|
||||
'length', 'length_uom',
|
||||
|
||||
@@ -24,7 +24,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="weight"/>
|
||||
<field name="weight_uom" widget="selection"/>
|
||||
|
||||
<label id="measurements_help" string="Measurements for 1 default UOM." xalign="0" colspan="3"/>
|
||||
<label id="measurements_help" string="Measurements for 1 default UoM." xalign="0" colspan="3"/>
|
||||
</page>
|
||||
</xpath>
|
||||
</data>
|
||||
|
||||
@@ -96,7 +96,8 @@ class PriceListCache(ModelSQL):
|
||||
product = fields.Many2One(
|
||||
'product.product', "Product", required=True, ondelete='CASCADE')
|
||||
uom = fields.Many2One(
|
||||
'product.uom', "UoM", required=True, ondelete='CASCADE')
|
||||
'product.uom', "UoM", required=True, ondelete='CASCADE',
|
||||
help="The Unit of Measure.")
|
||||
raw_unit_prices = fields.Char("Unit Prices")
|
||||
pattern = fields.Dict(None, "Pattern")
|
||||
|
||||
|
||||
@@ -91,7 +91,8 @@ class Production(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
|
||||
'invisible': ~Eval('product'),
|
||||
})
|
||||
uom_category = fields.Function(fields.Many2One(
|
||||
'product.uom.category', 'Uom Category'),
|
||||
'product.uom.category', "UoM Category",
|
||||
help="The category of Unit of Measure."),
|
||||
'on_change_with_uom_category')
|
||||
unit = fields.Many2One(
|
||||
'product.uom', "Unit",
|
||||
|
||||
@@ -101,5 +101,6 @@ class SplitProductionStart(ModelView):
|
||||
domain=[
|
||||
('category', '=', Eval('uom_category')),
|
||||
])
|
||||
uom_category = fields.Many2One('product.uom.category', 'Uom Category',
|
||||
readonly=True)
|
||||
uom_category = fields.Many2One(
|
||||
'product.uom.category', "UoM Category", readonly=True,
|
||||
help="The category of Unit of Measure.")
|
||||
|
||||
@@ -4,7 +4,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data grouped="1">
|
||||
<record model="ir.message" id="msg_change_purchase_uom">
|
||||
<field name="text">You are trying to change the purchase UoM on which the purchase prices are based.</field>
|
||||
<field name="text">You are trying to change the purchase unit of measurer on which the purchase prices are based.</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_erase_party_pending_purchase">
|
||||
<field name="text">You cannot erase party "%(party)s" while they have pending purchases with company "%(company)s".</field>
|
||||
|
||||
@@ -33,11 +33,14 @@ class Template(metaclass=PoolMeta):
|
||||
domain=[
|
||||
If(~Eval('active'), ('active', '=', False), ()),
|
||||
])
|
||||
purchase_uom = fields.Many2One('product.uom', 'Purchase UOM', states={
|
||||
purchase_uom = fields.Many2One(
|
||||
'product.uom', "Purchase UoM",
|
||||
states={
|
||||
'invisible': ~Eval('purchasable'),
|
||||
'required': Eval('purchasable', False),
|
||||
},
|
||||
domain=[('category', '=', Eval('default_uom_category'))])
|
||||
domain=[('category', '=', Eval('default_uom_category'))],
|
||||
help="The default Unit of Measure for purchases.")
|
||||
|
||||
@fields.depends('default_uom', 'purchase_uom', 'purchasable')
|
||||
def on_change_default_uom(self):
|
||||
|
||||
@@ -1146,7 +1146,9 @@ class Line(sequence_ordered(), ModelSQL, ModelView):
|
||||
'readonly': Eval('purchase_state') != 'draft',
|
||||
})
|
||||
product_uom_category = fields.Function(
|
||||
fields.Many2One('product.uom.category', 'Product Uom Category'),
|
||||
fields.Many2One(
|
||||
'product.uom.category', "Product UoM Category",
|
||||
help="The category of Unit of Measure for the product."),
|
||||
'on_change_with_product_uom_category')
|
||||
unit_price = Monetary(
|
||||
"Unit Price", currency='currency', digits=price_digits,
|
||||
|
||||
@@ -460,7 +460,9 @@ class BlanketAgreementLine(ModelSQL, ModelView):
|
||||
],
|
||||
states=_states)
|
||||
product_uom_category = fields.Function(
|
||||
fields.Many2One('product.uom.category', "Product UOM Category"),
|
||||
fields.Many2One(
|
||||
'product.uom.category', "Product UoM Category",
|
||||
help="The category of Unit of Measure for the product."),
|
||||
'on_change_with_product_uom_category')
|
||||
quantity = fields.Float("Quantity", digits='unit', states=_states)
|
||||
unit = fields.Many2One(
|
||||
|
||||
@@ -60,15 +60,20 @@ class PurchaseRequest(ModelSQL, ModelView):
|
||||
'readonly': STATES['readonly'],
|
||||
})
|
||||
product_uom_category = fields.Function(
|
||||
fields.Many2One('product.uom.category', "Product Uom Category"),
|
||||
fields.Many2One(
|
||||
'product.uom.category', "Product UoM Category",
|
||||
help="The category of Unit of Measure for the product."),
|
||||
'on_change_with_product_uom_category')
|
||||
computed_quantity = fields.Float('Computed Quantity', readonly=True)
|
||||
computed_unit = fields.Many2One(
|
||||
'product.uom', "Computed Unit", readonly=True)
|
||||
purchase_date = fields.Date('Best Purchase Date', readonly=True)
|
||||
supply_date = fields.Date('Expected Supply Date', readonly=True)
|
||||
default_uom = fields.Function(fields.Many2One(
|
||||
'product.uom', "Default UOM"), 'on_change_with_default_uom')
|
||||
default_uom = fields.Function(
|
||||
fields.Many2One(
|
||||
'product.uom', "Default UoM",
|
||||
help="The default Unit of Measure."),
|
||||
'on_change_with_default_uom')
|
||||
stock_level = fields.Float(
|
||||
"Stock at Supply Date", readonly=True, digits='default_uom')
|
||||
warehouse = fields.Many2One(
|
||||
|
||||
@@ -294,7 +294,9 @@ class QuotationLine(ModelSQL, ModelView):
|
||||
('category', '!=', -1)),
|
||||
])
|
||||
product_uom_category = fields.Function(
|
||||
fields.Many2One('product.uom.category', 'Product Uom Category'),
|
||||
fields.Many2One(
|
||||
'product.uom.category', "Product UoM Category",
|
||||
help="The category of Unit of Measure for the product."),
|
||||
'on_change_with_product_uom_category')
|
||||
unit_price = Monetary(
|
||||
"Unit Price", currency='currency', digits=price_digits)
|
||||
|
||||
@@ -432,7 +432,9 @@ class PurchaseRequisitionLine(sequence_ordered(), ModelSQL, ModelView):
|
||||
],
|
||||
states=_states)
|
||||
product_uom_category = fields.Function(
|
||||
fields.Many2One('product.uom.category', "Product UOM Category"),
|
||||
fields.Many2One(
|
||||
'product.uom.category', "Product UoM Category",
|
||||
help="The category of Unit of Measure for the product."),
|
||||
'on_change_with_product_uom_category')
|
||||
description = fields.Text("Description", states=_states)
|
||||
summary = fields.Function(fields.Char('Summary'), 'on_change_with_summary')
|
||||
|
||||
@@ -12,12 +12,13 @@ from trytond.pyson import Bool, Eval
|
||||
class PurchaseSecondaryMixin:
|
||||
__slots__ = ()
|
||||
purchase_secondary_uom = fields.Many2One(
|
||||
'product.uom', "Purchase Secondary UOM",
|
||||
'product.uom', "Purchase Secondary UoM",
|
||||
domain=[
|
||||
('category', '!=', Eval('default_uom_category')),
|
||||
])
|
||||
],
|
||||
help="The second Unit of Measure for purchases.")
|
||||
purchase_secondary_uom_factor = fields.Float(
|
||||
"Purchase Secondary UOM Factor", digits=uom_conversion_digits,
|
||||
"Purchase Secondary UoM Factor", digits=uom_conversion_digits,
|
||||
states={
|
||||
'required': Bool(Eval('purchase_secondary_uom')),
|
||||
'invisible': ~Eval('purchase_secondary_uom'),
|
||||
@@ -25,7 +26,7 @@ class PurchaseSecondaryMixin:
|
||||
help="The coefficient for the formula:\n"
|
||||
"1 (purchase unit) = coefficient (secondary unit)")
|
||||
purchase_secondary_uom_rate = fields.Float(
|
||||
"Purchase Secondary UOM Rate", digits=uom_conversion_digits,
|
||||
"Purchase Secondary UoM Rate", digits=uom_conversion_digits,
|
||||
states={
|
||||
'required': Bool(Eval('purchase_secondary_uom')),
|
||||
'invisible': ~Eval('purchase_secondary_uom'),
|
||||
@@ -34,7 +35,7 @@ class PurchaseSecondaryMixin:
|
||||
"coefficient (purchase unit) = 1 (secondary unit)")
|
||||
purchase_secondary_uom_category = fields.Function(
|
||||
fields.Many2One(
|
||||
'product.uom.category', "Purchase Secondary UOM Category"),
|
||||
'product.uom.category', "Purchase Secondary UoM Category"),
|
||||
'on_change_with_purchase_secondary_uom_category',
|
||||
searcher='search_purchase_secondary_uom_category')
|
||||
|
||||
@@ -148,7 +149,9 @@ class ProductSupplier(PurchaseSecondaryMixin, metaclass=PoolMeta):
|
||||
__name__ = 'purchase.product_supplier'
|
||||
|
||||
default_uom_category = fields.Function(
|
||||
fields.Many2One('product.uom.category', "Default UOM Category"),
|
||||
fields.Many2One(
|
||||
'product.uom.category', "Default UoM Category",
|
||||
help="The category of the default Unit of Measure."),
|
||||
'on_change_with_default_uom_category')
|
||||
|
||||
@fields.depends('template', '_parent_template.purchase_uom',
|
||||
|
||||
@@ -40,12 +40,17 @@ class Line(metaclass=PoolMeta):
|
||||
}),
|
||||
'on_change_with_secondary_unit_price', setter='set_secondary')
|
||||
|
||||
secondary_uom_factor = fields.Float("Secondary UOM Factor")
|
||||
secondary_uom_rate = fields.Float("Secondary UOM Rate")
|
||||
secondary_uom_factor = fields.Float(
|
||||
"Secondary UoM Factor",
|
||||
help="The factor for the secondary Unit of Measure.")
|
||||
secondary_uom_rate = fields.Float(
|
||||
"Secondary UoM Rate",
|
||||
help="The rate for the secondary Unit of Measure.")
|
||||
|
||||
product_secondary_uom_category = fields.Function(
|
||||
fields.Many2One(
|
||||
'product.uom.category', "Product Secondary UOM Category"),
|
||||
'product.uom.category', "Product Secondary UoM Category",
|
||||
help="The category of secondary Unit of Measure for the product."),
|
||||
'on_change_with_product_secondary_uom_category')
|
||||
|
||||
@fields.depends('product', 'product_supplier')
|
||||
@@ -176,7 +181,9 @@ class RequisitionLine(metaclass=PoolMeta):
|
||||
|
||||
product_secondary_uom_category = fields.Function(
|
||||
fields.Many2One(
|
||||
'product.uom.category', "Product Secondary UOM Category"),
|
||||
'product.uom.category', "Product Secondary UoM Category",
|
||||
help="The category of secondary Unit of Measure "
|
||||
"for the product."),
|
||||
'on_change_with_product_secondary_uom_category')
|
||||
|
||||
@classmethod
|
||||
@@ -245,7 +252,9 @@ class BlanketAgreementLine(metaclass=PoolMeta):
|
||||
|
||||
product_secondary_uom_category = fields.Function(
|
||||
fields.Many2One(
|
||||
'product.uom.category', "Product Secondary UOM Category"),
|
||||
'product.uom.category', "Product Secondary UOM Category",
|
||||
help="The category of secondary Unit of Measure "
|
||||
"for the product."),
|
||||
'on_change_with_product_secondary_uom_category')
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -38,14 +38,15 @@ class Template(metaclass=PoolMeta):
|
||||
__name__ = 'product.template'
|
||||
salable = fields.Boolean("Salable")
|
||||
sale_uom = fields.Many2One(
|
||||
'product.uom', "Sale UOM",
|
||||
'product.uom', "Sale UoM",
|
||||
states={
|
||||
'invisible': ~Eval('salable', False),
|
||||
'required': Eval('salable', False),
|
||||
},
|
||||
domain=[
|
||||
('category', '=', Eval('default_uom_category')),
|
||||
])
|
||||
],
|
||||
help="The default Unit of Measure for sales.")
|
||||
lead_time = fields.MultiValue(fields.TimeDelta(
|
||||
"Lead Time",
|
||||
domain=['OR',
|
||||
|
||||
@@ -1264,7 +1264,9 @@ class SaleLine(TaxableMixin, sequence_ordered(), ModelSQL, ModelView):
|
||||
depends={
|
||||
'company', 'warehouse', 'sale_date', 'currency', 'customer'})
|
||||
product_uom_category = fields.Function(
|
||||
fields.Many2One('product.uom.category', 'Product Uom Category'),
|
||||
fields.Many2One(
|
||||
'product.uom.category', "Product UoM Category",
|
||||
help="The category of Unit of Measure for the product."),
|
||||
'on_change_with_product_uom_category')
|
||||
unit_price = Monetary(
|
||||
"Unit Price", digits=price_digits, currency='currency',
|
||||
|
||||
@@ -445,7 +445,9 @@ class BlanketAgreementLine(ModelSQL, ModelView):
|
||||
},
|
||||
depends=['company', 'unit', 'quantity'])
|
||||
product_uom_category = fields.Function(
|
||||
fields.Many2One('product.uom.category', "Product UOM Category"),
|
||||
fields.Many2One(
|
||||
'product.uom.category', "Product UoM Category",
|
||||
help="The category of Unit of Measure for the product."),
|
||||
'on_change_with_product_uom_category')
|
||||
quantity = fields.Float("Quantity", digits='unit', states=_states)
|
||||
unit = fields.Many2One(
|
||||
|
||||
@@ -7,7 +7,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="text">The numbers for each company's gift cards must be unique.</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_gift_card_invalid_uom">
|
||||
<field name="text">The default UOM for the gift card "%(template)s" must be "%(unit)s".</field>
|
||||
<field name="text">The default unit of measure for the gift card "%(template)s" must be "%(unit)s".</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_gift_card_move_quantity">
|
||||
<field name="text">To do the move "%(move)s", you must use exactly %(quantity)d gift card(s).</field>
|
||||
|
||||
@@ -12,12 +12,13 @@ from trytond.pyson import Bool, Eval
|
||||
class SaleSecondaryMixin:
|
||||
__slots__ = ()
|
||||
sale_secondary_uom = fields.Many2One(
|
||||
'product.uom', "Sale Secondary UOM",
|
||||
'product.uom', "Sale Secondary UoM",
|
||||
domain=[
|
||||
('category', '!=', Eval('default_uom_category')),
|
||||
])
|
||||
],
|
||||
help="The secondary Unit of Measure for sales.")
|
||||
sale_secondary_uom_factor = fields.Float(
|
||||
"Sale Secondary UOM Factor", digits=uom_conversion_digits,
|
||||
"Sale Secondary UoM Factor", digits=uom_conversion_digits,
|
||||
states={
|
||||
'required': Bool(Eval('sale_secondary_uom')),
|
||||
'invisible': ~Eval('sale_secondary_uom'),
|
||||
@@ -25,7 +26,7 @@ class SaleSecondaryMixin:
|
||||
help="The coefficient for the formula:\n"
|
||||
"1 (sale unit) = coefficient (secondary unit)")
|
||||
sale_secondary_uom_rate = fields.Float(
|
||||
"Sale Secondary UOM Rate", digits=uom_conversion_digits,
|
||||
"Sale Secondary UoM Rate", digits=uom_conversion_digits,
|
||||
states={
|
||||
'required': Bool(Eval('sale_secondary_uom')),
|
||||
'invisible': ~Eval('sale_secondary_uom'),
|
||||
@@ -33,7 +34,7 @@ class SaleSecondaryMixin:
|
||||
help="The coefficient for the formula:\n"
|
||||
"coefficient (sale unit) = 1 (secondary unit)")
|
||||
sale_secondary_uom_category = fields.Function(
|
||||
fields.Many2One('product.uom.category', "Sale Secondary UOM Category"),
|
||||
fields.Many2One('product.uom.category', "Sale Secondary UoM Category"),
|
||||
'on_change_with_sale_secondary_uom_category',
|
||||
searcher='search_sale_secondary_uom_category')
|
||||
|
||||
@@ -144,7 +145,9 @@ class ProductCustomer(SaleSecondaryMixin, metaclass=PoolMeta):
|
||||
__name__ = 'sale.product_customer'
|
||||
|
||||
default_uom_category = fields.Function(
|
||||
fields.Many2One('product.uom.category', "Default UOM Category"),
|
||||
fields.Many2One(
|
||||
'product.uom.category', "Default UoM Category",
|
||||
help="The category of default Unit of Measure."),
|
||||
'on_change_with_default_uom_category')
|
||||
|
||||
@fields.depends('template', '_parent_template.sale_uom',
|
||||
|
||||
@@ -40,12 +40,17 @@ class Line(metaclass=PoolMeta):
|
||||
}),
|
||||
'on_change_with_secondary_unit_price', setter='set_secondary')
|
||||
|
||||
secondary_uom_factor = fields.Float("Secondary UOM Factor")
|
||||
secondary_uom_rate = fields.Float("Secondary UOM Rate")
|
||||
secondary_uom_factor = fields.Float(
|
||||
"Secondary UoM Factor",
|
||||
help="The factor for the secondary Unit of Measure.")
|
||||
secondary_uom_rate = fields.Float(
|
||||
"Secondary UoM Rate",
|
||||
help="The rate for the secondary Unit of Measure.")
|
||||
|
||||
product_secondary_uom_category = fields.Function(
|
||||
fields.Many2One(
|
||||
'product.uom.category', "Product Secondary UOM Category"),
|
||||
'product.uom.category', "Product Secondary UoM Category",
|
||||
help="The category of secondary Unit of Measure for the product."),
|
||||
'on_change_with_product_secondary_uom_category')
|
||||
|
||||
@fields.depends('product')
|
||||
@@ -196,7 +201,9 @@ class BlanketAgreementLine(metaclass=PoolMeta):
|
||||
|
||||
product_secondary_uom_category = fields.Function(
|
||||
fields.Many2One(
|
||||
'product.uom.category', "Product Secondary UOM Category"),
|
||||
'product.uom.category', "Product Secondary UoM Category",
|
||||
help="The category of the secondary Unit of Measure "
|
||||
"for the product."),
|
||||
'on_change_with_product_secondary_uom_category')
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -171,10 +171,11 @@ class Location(DeactivableMixin, tree(), ModelSQL, ModelView):
|
||||
help="The amount of stock expected to be in the location."),
|
||||
'get_quantity', searcher='search_quantity')
|
||||
quantity_uom = fields.Function(fields.Many2One(
|
||||
'product.uom', "Quantity UOM"),
|
||||
'product.uom', "Quantity UoM",
|
||||
help="The Unit of Measure for the quantities."),
|
||||
'get_quantity_uom')
|
||||
quantity_uom_digits = fields.Function(fields.Integer(
|
||||
"Quantity UOM Digits"),
|
||||
"Quantity UoM Digits"),
|
||||
'get_quantity_uom')
|
||||
cost_value = fields.Function(fields.Numeric(
|
||||
"Cost Value", digits=price_digits,
|
||||
@@ -698,7 +699,9 @@ class ProductsByLocations(DeactivableMixin, ModelSQL, ModelView):
|
||||
fields.Float("Forecast Quantity", digits='default_uom'),
|
||||
'get_product', searcher='search_product')
|
||||
default_uom = fields.Function(
|
||||
fields.Many2One('product.uom', "Default UOM"),
|
||||
fields.Many2One(
|
||||
'product.uom', "Default UoM",
|
||||
help="The default Unit of Measure."),
|
||||
'get_product', searcher='search_product')
|
||||
cost_value = fields.Function(
|
||||
fields.Numeric("Cost Value"), 'get_product')
|
||||
|
||||
@@ -4,7 +4,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data grouped="1">
|
||||
<record model="ir.message" id="msg_product_change_default_uom">
|
||||
<field name="text">You cannot change the default UOM of a product which is associated with stock moves.</field>
|
||||
<field name="text">You cannot change the default unit of measure of a product which is associated with stock moves.</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_product_change_type">
|
||||
<field name="text">You cannot change the type of a product which is associated with stock moves.</field>
|
||||
|
||||
@@ -185,7 +185,9 @@ class Move(Workflow, ModelSQL, ModelView):
|
||||
depends={'company'},
|
||||
help="The product that the move is associated with.")
|
||||
product_uom_category = fields.Function(
|
||||
fields.Many2One('product.uom.category', 'Product Uom Category'),
|
||||
fields.Many2One(
|
||||
'product.uom.category', "Product UoM Category",
|
||||
help="The category of Unit of Measure for the product."),
|
||||
'on_change_with_product_uom_category')
|
||||
unit = fields.Many2One(
|
||||
'product.uom', "Unit", required=True,
|
||||
@@ -1587,7 +1589,7 @@ class Move(Workflow, ModelSQL, ModelView):
|
||||
"""
|
||||
Executes the supplied query to compute for each location and product
|
||||
the stock quantity in the default uom of the product and rounded to
|
||||
Uom's rounding digits.
|
||||
UoM's rounding digits.
|
||||
|
||||
See compute_quantites_query for params explanation.
|
||||
|
||||
|
||||
@@ -290,7 +290,9 @@ class ForecastLine(ModelSQL, ModelView):
|
||||
],
|
||||
states=_states)
|
||||
product_uom_category = fields.Function(
|
||||
fields.Many2One('product.uom.category', 'Product Uom Category'),
|
||||
fields.Many2One(
|
||||
'product.uom.category', "Product UoM Category",
|
||||
help="The category of Unit of Measure for the product."),
|
||||
'on_change_with_product_uom_category')
|
||||
unit = fields.Many2One(
|
||||
'product.uom', "Unit", required=True,
|
||||
|
||||
@@ -85,7 +85,9 @@ class Lot(DeactivableMixin, ModelSQL, ModelView, LotMixin, StockMixin):
|
||||
fields.Float("Forecast Quantity", digits='default_uom'),
|
||||
'get_quantity', searcher='search_quantity')
|
||||
default_uom = fields.Function(
|
||||
fields.Many2One('product.uom', "Default UOM"),
|
||||
fields.Many2One(
|
||||
'product.uom', "Default UoM",
|
||||
help="The default Unit of Measure."),
|
||||
'on_change_with_default_uom')
|
||||
|
||||
@classmethod
|
||||
@@ -306,7 +308,9 @@ class LotsByLocations(ModelSQL, ModelView):
|
||||
fields.Float("Forecast Quantity", digits='default_uom'),
|
||||
'get_lot', searcher='search_lot')
|
||||
default_uom = fields.Function(
|
||||
fields.Many2One('product.uom', "Default UOM"),
|
||||
fields.Many2One(
|
||||
'product.uom', "Default UoM",
|
||||
help="The default Unit of Measure."),
|
||||
'get_lot', searcher='search_lot')
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -64,29 +64,32 @@ class MeasurementsMixin:
|
||||
"Length", digits='length_uom',
|
||||
help="The length of the package.")
|
||||
length_uom = fields.Many2One(
|
||||
'product.uom', "Length UOM",
|
||||
'product.uom', "Length UoM",
|
||||
domain=[('category', '=', Id('product', 'uom_cat_length'))],
|
||||
states={
|
||||
'required': Bool(Eval('length')),
|
||||
})
|
||||
},
|
||||
help="The Unit of Measure for the package length.")
|
||||
height = fields.Float(
|
||||
"Height", digits='height_uom',
|
||||
help="The height of the package.")
|
||||
height_uom = fields.Many2One(
|
||||
'product.uom', "Height UOM",
|
||||
'product.uom', "Height UoM",
|
||||
domain=[('category', '=', Id('product', 'uom_cat_length'))],
|
||||
states={
|
||||
'required': Bool(Eval('height')),
|
||||
})
|
||||
},
|
||||
help="The Unit of Measure for the package height.")
|
||||
width = fields.Float(
|
||||
"Width", digits='width_uom',
|
||||
help="The width of the package.")
|
||||
width_uom = fields.Many2One(
|
||||
'product.uom', "Width UOM",
|
||||
'product.uom', "Width UoM",
|
||||
domain=[('category', '=', Id('product', 'uom_cat_length'))],
|
||||
states={
|
||||
'required': Bool(Eval('width')),
|
||||
})
|
||||
},
|
||||
help="The Unit of Measure for the package width.")
|
||||
|
||||
packaging_volume = fields.Float(
|
||||
"Packaging Volume", digits='packaging_volume_uom',
|
||||
@@ -98,21 +101,23 @@ class MeasurementsMixin:
|
||||
},
|
||||
help="The volume of the package.")
|
||||
packaging_volume_uom = fields.Many2One(
|
||||
'product.uom', "Packaging Volume UOM",
|
||||
'product.uom', "Packaging Volume UoM",
|
||||
domain=[('category', '=', Id('product', 'uom_cat_volume'))],
|
||||
states={
|
||||
'required': Bool(Eval('packaging_volume')),
|
||||
})
|
||||
},
|
||||
help="The Unit of Measure for the packaging volume.")
|
||||
|
||||
packaging_weight = fields.Float(
|
||||
"Packaging Weight", digits='packaging_weight_uom',
|
||||
help="The weight of the package when empty.")
|
||||
packaging_weight_uom = fields.Many2One(
|
||||
'product.uom', "Packaging Weight UOM",
|
||||
'product.uom', "Packaging Weight UoM",
|
||||
domain=[('category', '=', Id('product', 'uom_cat_weight'))],
|
||||
states={
|
||||
'required': Bool(Eval('packaging_weight')),
|
||||
})
|
||||
},
|
||||
help="The Unit of Measure for the packaging weight.")
|
||||
|
||||
@fields.depends(
|
||||
'packaging_volume', 'packaging_volume_uom',
|
||||
|
||||
@@ -39,7 +39,8 @@ class Move(metaclass=PoolMeta):
|
||||
|
||||
product_secondary_uom_category = fields.Function(
|
||||
fields.Many2One(
|
||||
'product.uom.category', "Product Secondary UOM Category"),
|
||||
'product.uom.category', "Product Secondary UoM Category",
|
||||
help="The category of secondary Unit of Measure for the product."),
|
||||
'get_product_secondary_uom_category')
|
||||
|
||||
@fields.depends('quantity', 'unit', 'secondary_unit', 'origin')
|
||||
|
||||
@@ -19,12 +19,14 @@ class Configuration(metaclass=PoolMeta):
|
||||
|
||||
measurement_weight_uom = fields.MultiValue(
|
||||
fields.Many2One(
|
||||
'product.uom', "Measurement Weight Uom", required=True,
|
||||
domain=[('category', '=', Id('product', 'uom_cat_weight'))]))
|
||||
'product.uom', "Measurement Weight UoM", required=True,
|
||||
domain=[('category', '=', Id('product', 'uom_cat_weight'))],
|
||||
help="The default Unit of Measure for weight."))
|
||||
measurement_volume_uom = fields.MultiValue(
|
||||
fields.Many2One(
|
||||
'product.uom', "Measurement Volume Uom", required=True,
|
||||
domain=[('category', '=', Id('product', 'uom_cat_volume'))]))
|
||||
'product.uom', "Measurement Volume UoM", required=True,
|
||||
domain=[('category', '=', Id('product', 'uom_cat_volume'))],
|
||||
help="The default Unit of Measure for volume."))
|
||||
|
||||
@classmethod
|
||||
def multivalue_model(cls, field):
|
||||
@@ -49,10 +51,10 @@ class ConfigurationMeasurement(ModelSQL, CompanyValueMixin):
|
||||
__name__ = 'stock.configuration.measurement'
|
||||
|
||||
measurement_weight_uom = fields.Many2One(
|
||||
'product.uom', "Measurement Weight Uom", required=True,
|
||||
'product.uom', "Measurement Weight UoM", required=True,
|
||||
domain=[('category', '=', Id('product', 'uom_cat_weight'))])
|
||||
measurement_volume_uom = fields.Many2One(
|
||||
'product.uom', "Measurement Volume Uom", required=True,
|
||||
'product.uom', "Measurement Volume UoM", required=True,
|
||||
domain=[('category', '=', Id('product', 'uom_cat_volume'))])
|
||||
|
||||
@classmethod
|
||||
@@ -179,7 +181,10 @@ class MeasurementsMixin(object):
|
||||
help="The total weight of the record's moves."),
|
||||
'get_measurements', searcher='search_measurements')
|
||||
weight_uom = fields.Function(
|
||||
fields.Many2One('product.uom', "Weight Uom"), 'get_measurements_uom')
|
||||
fields.Many2One(
|
||||
'product.uom', "Weight UoM",
|
||||
help="The Unit of Measure of weight."),
|
||||
'get_measurements_uom')
|
||||
volume = fields.Function(
|
||||
fields.Float(
|
||||
"Volume", digits='volume_uom',
|
||||
@@ -189,7 +194,10 @@ class MeasurementsMixin(object):
|
||||
help="The total volume of the record's moves."),
|
||||
'get_measurements', searcher='search_measurements')
|
||||
volume_uom = fields.Function(
|
||||
fields.Many2One('product.uom', "Volume Uom"), 'get_measurements_uom')
|
||||
fields.Many2One(
|
||||
'product.uom', "Volume UoM",
|
||||
help="The Unit of Measure of volume."),
|
||||
'get_measurements_uom')
|
||||
|
||||
@classmethod
|
||||
def get_measurements_uom(cls, shipments, name):
|
||||
@@ -364,11 +372,12 @@ class Package(MeasurementsMixin, object, metaclass=PoolMeta):
|
||||
"Additional Weight", digits='additional_weight_uom',
|
||||
help="The weight to add to the packages.")
|
||||
additional_weight_uom = fields.Many2One(
|
||||
'product.uom', "Additional Weight Uom",
|
||||
'product.uom', "Additional Weight UoM",
|
||||
domain=[('category', '=', Id('product', 'uom_cat_weight'))],
|
||||
states={
|
||||
'required': Bool(Eval('additional_weight')),
|
||||
})
|
||||
},
|
||||
help="The Unit of Measure for additional weight.")
|
||||
total_weight = fields.Function(
|
||||
fields.Float(
|
||||
"Total Weight", digits='weight_uom',
|
||||
|
||||
@@ -84,8 +84,9 @@ class SplitMoveStart(ModelView):
|
||||
domain=[
|
||||
('category', '=', Eval('uom_category')),
|
||||
])
|
||||
uom_category = fields.Many2One('product.uom.category', 'Uom Category',
|
||||
readonly=True)
|
||||
uom_category = fields.Many2One(
|
||||
'product.uom.category', "UoM Category", readonly=True,
|
||||
help="The category of Unit of Measure.")
|
||||
|
||||
|
||||
class SplitMove(Wizard):
|
||||
|
||||
@@ -25,7 +25,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="text">To update products on the shop "%(shop)s", you must set the language to "%(shopify_primary_locale)s" instead of "%(shop_language)s".</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_product_shopify_uom_digits">
|
||||
<field name="text">To update product "%(product)s" on Shopify, you must use an UOM without digits.</field>
|
||||
<field name="text">To update product "%(product)s" on Shopify, you must use an unit of measure without digits.</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_product_change_template">
|
||||
<field name="text">To change the template of product "%(product)s" you must unpublish it from the Shopify web shops.</field>
|
||||
|
||||
@@ -70,12 +70,13 @@ class Template(IdentifiersMixin, metaclass=PoolMeta):
|
||||
__name__ = 'product.template'
|
||||
|
||||
shopify_uom = fields.Many2One(
|
||||
'product.uom', "Shopify UOM",
|
||||
'product.uom', "Shopify UoM",
|
||||
states={
|
||||
'readonly': Bool(Eval('shopify_identifiers', [-1])),
|
||||
'invisible': ~Eval('salable', False),
|
||||
},
|
||||
depends={'default_uom_category'})
|
||||
depends={'default_uom_category'},
|
||||
help="The Unit of Measure of the product on Shopify.")
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
|
||||
Reference in New Issue
Block a user