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


i created 2 buttons on form, when click fenced button if description, analyse , conclusion not empty state value should fenced else nothing should happens , when click not yet button, if description or analyse or conclusion not empty state value should change in progress.

here 2 buttons 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>                            

and here functions 2 buttons:

    @api.depends('description','analyse','conclusion')      def write_new(self):          if self.description != "" , self.analyse != "" , 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"   

in odoo don't use empty field:

self.description != "" 

empty field or null in odoo false:

self.description != false  

Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -