Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
3806 Vizualizări

In the Settings, we can set the unit of measure as Meters or Feet. I would like to add one more unit of measurement - Centimeters


I found this Selection field in product/models/res_config_settings.py

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')

In my module I created new model and tried to add a new value into Selection:

from odoo import api, fields, models

class ResConfigSettings(models.TransientModel):
    _inherit = 'res.config.settings'

    product_volume_volume_in_cubic_feet = fields.Selection(selection_add=[
        ('2''Cubic Centimeters'),
    ])

But nothing has changed. New field has not appeared.

I know that even if it appears, when choosing Centimeters, there will not be a change to centimeters, but this is where I want to start.


Do you know how to solve this problem?

Imagine profil
Abandonează
Cel mai bun răspuns

Hi,

Please try like this,

class AddSelection(models.TransientModel):
_inherit = 'res.config.settings'

product_volume_volume_in_cubic_feet = fields.Selection(selection_add=[('cm', 'Centimeters')])

Regards

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
3
dec. 19
4253
2
oct. 24
1263
0
apr. 22
4078
3
mar. 24
6987
1
feb. 24
2319