Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I want in res.partner model make onchange event on field parent_id. this field already have onchange event by old api, so i changed it`s value on XML to on_change=1 and added .py code
@api.onchange('parent_id')after update, then i open contact form and changing parent_id, everything works as i want, but when i press save error occurrs
def onchange_parent_id(self, parent_id=None):
old_res = super(res_partner, self).onchange_parent_id(self.parent_id.id)old_res = super(res_partner, self).onchange_parent_id(self.parent_id.id)
if type(old_res) is dict and old_res.has_key('value'):
for field, value in old_res.get('value').items():
if hasattr(self, field):
setattr(self, field, value)setattr(self, field, value)
self.category_id = self.parent_id.category_id
File "/opt/odoo-vaimada/openerp/addons/base/res/res_partner.py", line 477, in _fields_sync
TypeError: onchange_parent_id() takes at most 2 arguments (6 given)
as i understand it occurrs becouse on create other method (_fields_sync) also calls this onchange_parent_id methot by 'old style'. Maybe someone can advice me how to fix this.
Thanks in advance
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 9/19/16, 10:00 AM|
|Seen: 253 times|
|Last updated: 11/28/16, 7:07 AM|