跳至内容
菜单
此问题已终结
2 回复
1040 查看


On this selection field I want to remove the type consumable on odoo15 can a type be removed from a selection form xml 

形象
丢弃
最佳答案

Hi,


In Odoo 15, to remove a selection option like 'consu' (Consumable) from the detailed_type field, you must override the field in Python, not XML, as selection values are defined in the model.


class ProductTemplate(models.Model):

    _inherit = 'product.template'


    detailed_type = fields.Selection([

        ('product', 'Storable Product'),

        ('service', 'Service'),

        # 'consu' removed

    ], string='Product Type', required=True, default='product')

Before applying this, update or delete all products with detailed_type = 'consu' to avoid errors.


Hope it helps.

形象
丢弃
最佳答案

You can remove the consumable type by overriding the detailed_type field in the product.template module using Python. However, before making any changes, ensure that no products are currently assigned to that type.

Thank you.

形象
丢弃
相关帖文 回复 查看 活动
0
3月 15
10075
1
3月 15
4446
0
3月 15
3324
0
3月 15
3458
0
3月 15
2932