Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
13779 Lượt xem

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')



Ảnh đại diện
Huỷ bỏ

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

Câu trả lời hay nhất

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)
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất
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
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 1 25
1914
2
thg 9 22
9666
2
thg 4 22
4714
0
thg 7 21
7334
1
thg 3 21
5069