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

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -