Hi!!!!!!
Please who can help me please!!!
i want to change the value of a field in class a with a value of a field in class b.
Please i need your help
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hi!!!!!!
Please who can help me please!!!
i want to change the value of a field in class a with a value of a field in class b.
Please i need your help
Dear Abdelwahed,
There are lots of examples of onchange in addons.
Here I given simple example of onchange method
Definition of on change methods in a view looks like this:
<field name="name" on_change="name_change(name, address, city)"/>
And here is the corresponding method in the model:
def name_change(self, cr, uid, ids, name, address, city, context=None):
...
return {
'value': {
'address': ...
'city': ...
}
}
2nd Example
In xml file or view file.
<field name="partner_id" on_change="onchange_partner(partner_id)"/>
In python file or model file
def onchange_partner(self, cr, uid, ids, partner_id, context=None):
res = {}
if partner_id:
obj = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context)
res['field1'] = obj.field1
res['field2'] = obj.field2
res['field3'] = 'Hello' # this field type must be char or if not then give
#value accordingly, its just to prove you that values are filled on onchange.
return {'value': res}
Hope this will help you.
Thanks & Regards
Ankit H Gandhi
Ankit Gandhi Thanks for your answers. That is very helpful ;)
inherit class a in b, then change your field value.
Guys!!!!! Thanks a lot for your answers. But nothing works fine. I want to know how to change the value of the field when i am not in its class. Here is what i have done: I have inhereited class a in b and then i have done: obj7 = self.pool.get('project.service.line') obj_ids7 = obj7.search(cr, uid, [('project_id', '=', res9[0]['id']),('int_services', '=', name_service)]) res7 = obj7.read(cr, uid, obj_ids7, ['points_charges','credit_service'], context) print res7 return {'credit_service':credits} but... :/
Create an account today to enjoy exclusive features and engage with our awesome community!
Tilmeld digRelated Posts | Besvarelser | Visninger | Aktivitet | |
---|---|---|---|---|
|
0
apr. 24
|
1936 | ||
|
4
nov. 23
|
6034 | ||
|
0
okt. 23
|
1788 | ||
|
0
dec. 22
|
2679 | ||
|
2
dec. 23
|
19450 |
Please , there is no one to give me even a simple example :/
Can you describe more for clearly understand. Also give example what you want.