跳至内容
菜单
此问题已终结
2 回复
716 查看
: 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

形象
丢弃