콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
773 화면
: Many2many fields hr.employee.em_contrat and hr.employee.em_champ use the same table and columns


lors de la migration du module odoo 10  vers 15

code

# -*- coding: utf-8 -*-

from odoo import fields, models, api, _

from odoo.exceptions import ValidationError


class payrollReport(models.Model):

    _name = 'hr.payroll.report'

    _descripion = 'Payroll Report'

    _rec_name = 'report_title'



    rule_ids = fields.Many2many("hr.salary.rule", string=u"Salary Rules", required=True, )#default_order='sequence desc'

    report_title = fields.Char(string=u"Report Title")

    champ = fields.Many2many(comodel_name='ir.model.fields','rel_table1','current_model_id1','country_model_id1', string=u"Employés")

    

    contrat = fields.Many2many(comodel_name='ir.model.fields','rel_table2','current_model_id2','country_model_id2',string=u"Contrats")




-


# -*- coding: utf-8 -*-

from odoo import fields, models, api, _

from odoo.exceptions import ValidationError


class payrollReport(models.Model):

    _inherit = 'hr.employee'

    

    em_champ = fields.Many2many('ir.model.fields',string="Employés")

    

    em_contrat = fields.Many2many('ir.model.fields',string="Contrats")

아바타
취소
베스트 답변

Hey Cheikh Tidiane Diop,


I hope you are doing well.


This warning will be resolved by defining relation to each of the fields using the same table and columns.

Like you already did in the below fields 

Please find code in comment. 

I hope this will help you.

Thanks & Regards,
Email: odoo@aktivsoftware.com     

Skype: kalpeshmaheshwari

아바타
취소

Please find code here :-

champ = fields.Many2many(comodel_name='ir.model.fields','rel_table1','current_model_id1','country_model_id1', string=u"Employés")

contrat = fields.Many2many(comodel_name='ir.model.fields','rel_table2','current_model_id2','country_model_id2',string=u"Contrats")

To fix the problem, use the code shown below as a guide to update your code.

em_champ = fields.Many2many('ir.model.fields',’em_champ_rel’,string="Employés")

em_contrat = fields.Many2many('ir.model.fields',’em_contra_relt’,string="Contrats")

작성자 베스트 답변

Thanks for your answare 

already resolve thanks

아바타
취소