Skip to content
Snippets Groups Projects
Commit 57d3829d authored by Adrien Widart (awt)'s avatar Adrien Widart (awt)
Browse files

[FIX] stock: display weight UoM on storage category


On the form of a storage category, the UoM of the weight is
hardcoded. This is incorrect as it could be `lb` thanks to the
option in the Settings

OPW-3204924

closes odoo/odoo#117061

Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
parent 1ca90643
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,7 @@ class StorageCategory(models.Model):
('mixed', 'Allow mixed products')], default='mixed', required=True)
location_ids = fields.One2many('stock.location', 'storage_category_id')
company_id = fields.Many2one('res.company', 'Company')
weight_uom_name = fields.Char(string='Weight unit', compute='_compute_weight_uom_name')
_sql_constraints = [
('positive_max_weight', 'CHECK(max_weight >= 0)', 'Max weight should be a positive number.'),
......@@ -31,6 +32,9 @@ class StorageCategory(models.Model):
storage_category.product_capacity_ids = storage_category.capacity_ids.filtered(lambda c: c.product_id)
storage_category.package_capacity_ids = storage_category.capacity_ids.filtered(lambda c: c.package_type_id)
def _compute_weight_uom_name(self):
self.weight_uom_name = self.env['product.template']._get_weight_uom_name_from_ir_config_parameter()
def _set_storage_capacity_ids(self):
for storage_category in self:
storage_category.capacity_ids = storage_category.product_capacity_ids | storage_category.package_capacity_ids
......
......@@ -18,7 +18,7 @@
<label for="max_weight"/>
<div class="o_row">
<field name="max_weight"/>
<span>kg</span>
<span><field name="weight_uom_name"/></span>
</div>
<field name="company_id" groups="base.group_multi_company"/>
</group>
......@@ -55,7 +55,7 @@
<field name="arch" type="xml">
<tree string="Storage Categories" multi_edit="1">
<field name="name"/>
<field name="max_weight" string="Max Weight (kg)"/>
<field name="max_weight" string="Max Weight"/>
<field name="allow_new_product"/>
<field name="company_id" groups="base.group_multi_company"/>
</tree>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment