跳至内容
菜单
此问题已终结
3 回复
13755 查看

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



形象
丢弃

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

最佳答案

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)
形象
丢弃
最佳答案
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
形象
丢弃
相关帖文 回复 查看 活动
1
1月 25
1895
2
9月 22
9648
2
4月 22
4686
0
7月 21
7327
1
3月 21
5057