Skip to Content
Menu
This question has been flagged
1 Reply
2676 Views

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?

Avatar
Discard
Best Answer

Hi,

Try as follows:

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

Thanks

Avatar
Discard
Related Posts Replies Views Activity
0
Oct 21
999
1
Mar 23
1292
1
Aug 21
2025
0
Dec 24
59
1
Nov 24
1486