Until now, the volume measure displayed on the product form was only in m³. We now allow to choose between m³ and ft³. So, we add volume selection field (m³/ft³) on general settings and it will be display on product and product variants form view as configuration. We also Remove tooltip from weight and volume field. And display weight (kg or lb(s)) in product and product variants form view correctly, because currently weight didn't display on product form view before save the product but after this commit weight will be display. This commit is related to task ID 1869002. closes odoo/odoo#26542
50 lines
2.4 KiB
Python
50 lines
2.4 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import api, fields, models
|
|
|
|
|
|
class ResConfigSettings(models.TransientModel):
|
|
_inherit = 'res.config.settings'
|
|
|
|
company_share_product = fields.Boolean(
|
|
'Share product to all companies',
|
|
help="Share your product to all companies defined in your instance.\n"
|
|
" * Checked : Product are visible for every company, even if a company is defined on the partner.\n"
|
|
" * Unchecked : Each company can see only its product (product where company is defined). Product not related to a company are visible for all companies.")
|
|
group_uom = fields.Boolean("Units of Measure", implied_group='uom.group_uom')
|
|
group_product_variant = fields.Boolean("Variants and Options", implied_group='product.group_product_variant')
|
|
group_stock_packaging = fields.Boolean('Product Packagings',
|
|
implied_group='product.group_stock_packaging')
|
|
group_sale_pricelist = fields.Boolean("Use pricelists to adapt your price per customers",
|
|
implied_group='product.group_sale_pricelist',
|
|
help="""Allows to manage different prices based on rules per category of customers.
|
|
Example: 10% for retailers, promotion of 5 EUR on this product, etc.""")
|
|
group_product_pricelist = fields.Boolean("Show pricelists On Products",
|
|
implied_group='product.group_product_pricelist')
|
|
group_pricelist_item = fields.Boolean("Show pricelists to customers",
|
|
implied_group='product.group_pricelist_item')
|
|
product_weight_in_lbs = fields.Selection([
|
|
('0', 'Kilogram'),
|
|
('1', 'Pound'),
|
|
], 'Weight unit of measure', config_parameter='product.weight_in_lbs', default='0')
|
|
product_volume_volume_in_cubic_feet = fields.Selection([
|
|
('0', 'Cubic Meters'),
|
|
('1', 'Cubic Feet'),
|
|
], 'Volume unit of measure', config_parameter='product.volume_in_cubic_feet', default='0')
|
|
|
|
|
|
@api.model
|
|
def get_values(self):
|
|
res = super(ResConfigSettings, self).get_values()
|
|
product_rule = self.env.ref('product.product_comp_rule')
|
|
res.update(
|
|
company_share_product=not bool(product_rule.active),
|
|
)
|
|
return res
|
|
|
|
def set_values(self):
|
|
super(ResConfigSettings, self).set_values()
|
|
product_rule = self.env.ref('product.product_comp_rule')
|
|
product_rule.write({'active': not bool(self.company_share_product)})
|