Hi,
I am trying to map project to a employee profile
What I am trying to do is,I have a provision that is add employees in a project creation form
By clicking Add employees button there appears a wizard that can select multiple employees(many2many field), and that time the selected employees profile have the field project(many2many) that should automatically be filled.I tried this code
add_resources = fields.Many2many("hr.employee", string="Select Resources") //selecting employees for project
@api.multi
def add_employees_to_project(self):
for item in self.add_resources:
item.project_ids = self.id
self.add_resources = False
return {
'type': 'ir.actions.client',
'tag': 'reload',
}@api.multi
def add_resource_wizard(self):
context = {'edit': True, }
form_view = self.env.ref('project_ft.resource_project_form_view_add_wiz')
context['form_view_initial_mode'] = 'edit'
return {'name': _('Add Employees To Project'),
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'project.project',
'res_id': self.id,
'views': [(form_view.id, 'form'), ],
'context': context,
'target': 'new'}
Thank in advance
Veni V R