Hi
Field readonly don't stored in database when i use onchange method
Thanks
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hi
Field readonly don't stored in database when i use onchange method
Thanks
Hi Oussama,
Here you have to override this readonly field value in create and write method also based on onchange field value. First you have to check the value of onchange field and according that update vals in create and write method. Hope this will help.
Thanks Anup for your help,but idon't understand your response,if you can give me an example. Thanks
you have to write same code in both methods (create and write) which you have write in onchange method.
i use this code in my onchange method is stored in database but i can't edit it def fret_change (self,cr, uid,ids ,tva_p,t_c,prix_d,fret_p,context): vals={} vals['p_achat_ht']= (t_c*prix_d)*(1+(fret_p/100)) self.write(cr, uid,ids, vals,context=context) return {'value': vals}
i use this code in my onchange method is stored in database but i can't edit it def fret_change (self,cr, uid,ids ,tva_p,t_c,prix_d,fret_p,context): vals={} vals['p_achat_ht']= (t_c*prix_d)*(1+(fret_p/100)) self.write(cr, uid,ids, vals,context=context) return {'value': vals}
//Onchange method, try this way def fret_change(self, cr, uid, ids, prod_id=False, context=None): res = {} if prod_id: res['readonly_field']=value return {'value':res} //Create method def create(self, cr, uid, vals, context=None): if 'prod_id' in vals: vals['readonly_field'] = value //value may be calculate return super(object, self).create(cr, uid, vals, context) //Write Method def write(self, cr, uid, ids, vals, context=None): if 'prod_id' in vals: vals['readonly_field'] = value //value may be calculate return super(object, self).write(cr, uid, ids, vals, context)
//Onchange method, try this way def fret_change(self, cr, uid, ids, prod_id=False, context=None): res = {} if prod_id: res['readonly_field']=value return {'value':res} //Create method def create(self, cr, uid, vals, context=None): if 'prod_id' in vals: vals['readonly_field'] = value //value may be calculate return super(object, self).create(cr, uid, vals, context) //Write Method def write(self, cr, uid, ids, vals, context=None): if 'prod_id' in vals: vals['readonly_field'] = value //value may be calculate return super(object, self).write(cr, uid, ids, vals, context)
Thats because they are readonly..... You can either redefine the field not to be readonly, or change the field using some other way.