Skip to Content
Menu
This question has been flagged
3 Replies
12373 Views

I have this model.


class A(models.Model):

    list = fields.One2many('B',)

     @api.onchange('field')

             data = {}

             a.list.new(data)


I now change a field, how should I build Class B this model, Class B is a new model

class B(models.Model):

    aaa = fields.One2many('C',)

class C(models.Model):

    ccc = fields.many2one('product.product')



Avatar
Discard

hello! I would like to help but i dont clearly understand your problem

Best Answer

Hi,


'categories': fields.one2many('p_c.category', 'property_id', 'Categories'),
Parameters
  • comodel_name -- name of the target model (string)
  • inverse_name -- name of the inverse Many2one field in comodel_name (string)
  • domain -- an optional domain to set on candidate values on the client side (domain or string)
  • context -- an optional context to use on the client side when handling that field (dictionary)
  • auto_join -- whether JOINs are generated upon search through that field (boolean, by default False)
  • limit -- optional limit to use upon read (integer)
Avatar
Discard
Best Answer
Hope this may be helpful:

(0, 0, { values }) link to a new record that needs to be created with the given values dictionary (1, ID, { values }) update the linked record with id = ID (write *values* on it) (2, ID) remove and delete the linked record with id = ID (calls unlink on ID, that will delete the object completely, and the link to it as well) (3, ID) cut the link to the linked record with id = ID (delete the relationship between the two objects but does not delete the target object itself) (4, ID) link to existing record with id = ID (adds a relationship) (5) unlink all (like using (3,ID) for all linked records) (6, 0, [IDs]) replace the list of linked IDs (like using (5) then (4,ID) for each ID in the list of IDs) Regards, Mayank Gosai
Avatar
Discard
Related Posts Replies Views Activity
2
Sep 22
7886
2
Apr 22
2448
0
Jul 21
5313
1
Mar 21
3339
5
Aug 20
16277