如何在odoo 13中查找字段的Onchange函数

问题描述 投票:1回答:1

希望我的消息对您很满意,

我继承了一个odoo模型(product.attribute),并且重写了一个字段(display_type)。

class darazProductAttributes(models.Model):
    _inherit = "product.attribute"

    display_type = fields.Selection([
        ('text', 'Text'),
        ('radio', 'Radio'),
        ('select', 'Select'),
        ('color', 'Color')], default='radio', required=True, help="The display type used in the Product Configurator.")

我在字段中添加了另一个选项(文本)。现在,选择字段的选择将加载product.attribute.lines模型窗体,基本上它具有onchange方法。方法名称。enter image description here

所以我想重写该功能。

谢谢

odoo
1个回答
0
投票

字段可以具有多个onchange方法,您要做的就是寻找以onchange装饰的方法:

@api.onchange('your_field_name')
© www.soinside.com 2019 - 2024. All rights reserved.