为什么即使条件不满足状态也会改变?

why the state changes even when the conditions are not satisfied?

我在表单上创建了两个按钮,当我单击 Fenced 按钮时,如果 Description、analyze 和 conclusion 不为空,那么状态值应该是 Fenced 否则什么都不会发生,当我单击 Not yet 按钮时,如果 Description、analyze 和 analyze或结论不为空状态值应更改为进行中。

这里是我的两个按钮 Fenced 和 Not yet:

 <group name="group_tests_buttons" class="oe_button_box" col="6">
                        <button name="write_new"
                            type="object"
                            class="oe_stat_button"
                            string="Fenced">  
                        </button>
                       <button name="write_new2"
                            type="object"
                            class="oe_stat_button"
                            string="Not yet">
                        </button>                            

下面是两个按钮的功能:

    @api.depends('Description','analyse','conclusion')
    def write_new(self):
        if self.Description != "" and self.analyse != "" and self.conclusion != "":
            self.state = "Fenced"   


    @api.depends('Description','analyse','conclusion')
    def write_new2(self): 
        if self.Description != "" or self.analyse != "" or self.conclusion != "":
            self.state = "In progress"   

在 odoo 中不要将此用于空字段:

self.Description != ""

odoo 中的空字段或 null 为假:

self.Description != False