I have two fields, both are many2one
'dest_location' : fields.many2one('location.location',"New Location"),
'new_project' : fields.many2one('project.project','New Project'),
<field name="dest_location" on_change="onchange_project_id(dest_location)"/>
<field name="new_project" on_change="onchange_location_id(new_project)" />
My doubt :
Error in
def onchange_project_id(self, cr, uid, id, dest_location, context=None):
if dest_location:
project = self.pool.get('location.location').browse(cr, uid, dest_location, context=context).location_ids
return {'value': {'new_project': project.name}}
How to return one2many field in a onchange function?
class location_location(osv.osv):
_name = 'location.location'
_description = 'Site Information'
_columns = {
'name': fields.char('Location'),
'location_ids': fields.one2many('project.location', 'project_id', 'Work done'),
}
location_location()
class project_location(osv.osv):
_name = "project.location"
_description = "Project Location"
_columns = {
'project_id': fields.many2one('project.project', 'Project'),
}
How can i import all projects in the location table when onchange works?