If I have two models, f.e. : 'my.model.items' and 'my.model' where 'my.model.items' has many2one field to 'my.model' and 'my.model' has one2many field to 'my.model.items'
How could I implement ability to select from existing 'my.model.items' records in 'my.model'?
Re-Edit: Having models as described above, in 'my.model' form I only have functionality to create records in 'my.model.items'. I would like to have functionality in 'my.model' form to select multiple existing records from 'my.model.items', and create a record containing this selection in 'my.model'.
I want to get the same result as Antanas, I have models A and B:
class A (models.Model):
_name = 'example.a'
name = fields.Char(string="Model A")
b_id = fields.Many2one('example.b', string='Model B')
class B (models.Model):
_name = 'example.b'
name = fields.Char(string="Model B")
a_ids = fields.One2many('example.a', 'b_id', string="Models A")
I want to add an item in a_ids from the existing records of A, not create new ones, how can this be achieved ? thanks in advance
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 4/25/13, 6:42 AM|
|Seen: 2645 times|
|Last updated: 3/16/15, 8:10 AM|