콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
1485 화면

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


아바타
취소
베스트 답변

Try this 

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

Thanks

아바타
취소
작성자 베스트 답변

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'


아바타
취소
관련 게시물 답글 화면 활동
4
3월 24
3357
1
2월 24
1964
1
10월 23
5325
0
7월 24
3012
0
7월 22
60