Can you provide a simple example on how to use the new api onchange method in order to copy the value of one field to another?
Related documentation here:
https://www.odoo.com/documentation/8.0/reference/orm.html#onchange-updating-ui-on-the-fly
Here is what I tried to do:
For every project task I want the task name (task summary) to load the name of the chosen project.
So in my custom module (in the .py file) I tried
from openerp import api
from openerp.osv import fields, osv
class custom_tasks(osv.osv):
_inherit = "project.task"
@api.onchange('project_id') # if these fields are changed, call method
def check_change(self):
self.name:value = self.project_id:value
_columns = {
'custom_tasks_abc': fields.char('Abc', size=30),
'custom_tasks_xyz': fields.char('Xyz', size=30),
}
dietech_tasks()
The documentation says there is no need to change the view in order to run something with 'onchange'.
The above code is not working. What should I do to make it work?