Hi Tristian,
One2Many fields do not need any column in the origin table.
comp_id = fields.One2Many('inventory.part', 'pid', 'comp_id', 'comp_id')
means that you will use the 'pid' column of the 'inventory.part' model to
find
comp_ids.
I think you should add something like this in 'inventory.part' :
assembly = Many2One('inventory.assembly', 'Assembly')
then in 'inventory.assembly' :
comp_id = fields.One2Many('inventory.part', 'assembly', 'Comps')
I do not know precisely the sue of the 'add_remove' parameter,
but I never used it yet so unless you have a specific reason to use
it, it is not necessary (and I think that's where your error comes from).
One2One fields may be deceitful because they use an extra table
to store the relation (as they inherit from the Many2Many field), which
is not obvious at first glance.
'relation_name' is the name of the model that represent this extra
table, which must have two Many2One fields :
- The 'origin' field must go toward the master of the link
('inventory.assembly'
in your case I think)
- The 'relation' field toward the child.
You should look for Many2Many uses in the existing code, as they
work the same as One2One link.
Good luck.
Jean CAVALLO
--
[email protected] mailing list