I have the following field, which is a Many2many Tags exatcly like in Employees module:
category_ids = fields.Many2many(
'it.recruitment.freelancer.category', 'freelancer_category_rel',
'freelancer_id', 'category_id',
string='Matching Positions',
ondelete='cascade',
default='_create_default_freelancer')
But instead of Employees, I'm using Freelancers. I've create a model to hold this tags: it.recruitment.freelancer.category.
Now I want to every time I create a new Freelancer, the category_ids field has already the 'Freelancer' tag.
This was my attempt:
def _create_default_freelancer(self):
model = 'it.recruitment.freelancer.category'
return self.env[model].search([{'name': "Freelancer"}]).id
Note: The 'Freelancer' tag is added on data.xml when you install the module.
Hello Miguel,
What determines that you have created a new freelancer? What condition is met for the employee to be a freelancer?
Or are you saying all employees are freelancers?
Thanks,
you can try the answer given in:
https://www.odoo.com/forum/help-1/how-to-set-a-default-value-on-many2many-tags-93362
hope it helps!