Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
2 Besvarelser
1488 Visninger

Hi

Please advise me on below error. 

TypeError: Many2many fields MrpWorkcenter.alternative_workcenter_ids and mrp.workcenter.alternative_workcenter_ids use the same table and columns


My code is to inherit mrp.workcenter and add a chatter in this model. There was not such error if not inheriting 'mail.thread' and 'mail.activity.mixin' 

class MrpWorkcenter(models.Model):
_inherit = ['mrp.workcenter',
'mail.thread',
'mail.activity.mixin',
] # add a chatter


Avatar
Kassér
Bedste svar

Try this 

class MrpWorkcenter(models.Model):
​_inherit='mrp.workcenter
_inherit = ['mail.thread','mail.activity.mixin'] # add a chatter

Thanks

Avatar
Kassér
Forfatter Bedste svar

Hello Bhushan,

With the change you suggested, it reported a new error now.

OwlError: An error occured in the owl lifecycle (see this Error's "cause" property)
    at handleError (http://localhost:8099/web/assets/616cff4/web.assets_web.min.js:916:101)
    at App.handleError (http://localhost:8099/web/assets/616cff4/web.assets_web.min.js:1542:29)
    at ComponentNode.initiateRender (http://localhost:8099/web/assets/616cff4/web.assets_web.min.js:1006:19)

Caused by: Error: "mrp.workcenter"."equipment_ids" field is undefined.
    at Field.parseFieldNode (http://localhost:8099/web/assets/616cff4/web.assets_web.min.js:7668:231)

My code:

class MrpWorkcenter(models.Model):
_inherit = 'mrp.workcenter'
_inherit = ['mail.thread',
'mail.activity.mixin',
] # add a chatter

equipment_ids = fields.One2many('maintenance.equipment', 'workcenter_id', string='Equipment', copy=True)
class MaintenanceEquipment(models.Model):
_inherit = 'maintenance.equipment'

workcenter_id = fields.Many2one('mrp.workcenter', string='Work Center', ondelete='cascade')

name = fields.Char('Equipment Name', required=False, translate=True)


I then tried to change code as follows. when upgrading the module from UI, the error became

File "C:\Odoo_code\elw\odoo\models.py", line 132, in raise_on_invalid_object_name

    raise ValueError(msg)

ValueError: The _name attribute MrpWorkcenter is not valid.

class MrpWorkcenter(models.Model):
_inherit = ['mail.thread',
'mail.activity.mixin',
] # add a chatter


class MrpWorkcenter1(models.Model):
_inherit = 'mrp.workcenter'


Avatar
Kassér
Related Posts Besvarelser Visninger Aktivitet
4
mar. 24
3357
1
feb. 24
1964
1
okt. 23
5325
0
jul. 24
3012
0
jul. 22
60