I have created a model "dws_contact_types" which has the field "contact_type_ids" which I want to show in a tree view of "res.partner" in the model "project.project". However the contact_type_ids field should be stored in projects and inside projects be related to a line in the tree-view with 'partners'. It should be possible to have a different value for the same partner in different projects.
So far this is what I have:
In my project.py script:
class DWSProjectContacts(models.Model):
_inherit = ["project.project"]
#description: "Contacts, added to the project in a seperate tab."
dws_project_contact_ids = fields.Many2many('res.partner', string='Contacts',store=True,copied=True)
location = fields.Char(string='location')
class DWSContacts(models.Model):
_inherit = ["res.partner"]
contact_type_ids = fields.Many2many('dws.contact.types', string='Contact type', store=True, copied=True)
Then in the treeview (shortened code):
This works, but the problem is that the value of contact_type_ids is stored in the partner model and therefore will have the same value in an other project. which is not what we want.
When I put the contact_type_ids field in project.project Odoo complains that there is no field "contact_type_ids" in the res.partner model.
Any help is appreciated. Thanks up forehand.