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

I have company_id field in stock.location which is many2one. When I change the field type from many2one to many2many by inheriting the model in custom addon, it shows the following error- 


My code:


class Location(models.Model):
_inherit = "stock.location"

company_id = fields.Many2many("res.company", string='Company12345', required=True

The error:

TypeError: Type of related field stock.quant.company_id is inconsistent with stock.location.company_id - - -


Any idea?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

Try as follows:

company_id = fields.Many2many("res.company", string="Company", required=True, related='')

Thanks

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 10 21
1865
1
thg 3 23
2252
1
thg 8 21
2894
1
thg 7 25
2355
2
thg 7 25
7851