Odoo Help

1

Got error " Field `message_follower_ids` does not exist" without not calling this field in view

By
Phong Vy
on 11/22/16, 5:48 AM 438 views

this is my view file

 <record id='social_insurance_tab' model='ir.ui.view'>
     <field name='social.insurance.tab'></field>

     <field name='model'>hr.insurance</field>

    <field name='inherit_id' ref='hr.view_employee_form'></field>

    <field name='arch' type='xml'>

        <data>

             <xpath expr="//notebook" position="inside">

                     <page string='Insurance'>

                             <field name='name'></field>

                      </page>

             </xpath>

        </data>

     </field>

here is my models file

from openerp import models, fields, api
class hr_insurance(models.Model):
     _name = 'hr.insurance'

     name = fields.Many2one('hr.contract', 'Insurance', required=True)


Just a simple code to add new tab into Employee but I got error : "ParseError: "Invalid view definition

Error details:

Field `message_follower_ids` does not exist"

without I don't call field "message_follower_ids" into my inherit view, how can I resolve this ? 

0
Jignesh Mehta
On 6/9/17, 8:07 AM

Hello Phong Vy,


You inherit hr.employee view and you used model hr.insurance. That is wrong. If you want to add insurance field hr.employee model then you inherit the hr.employee and add in employee form.


Ex:-

class Employee(models.Model)

     _inherit = 'hr.employee'

     insurance_id = fields.Many2one('hr.insurance', 'Insurance')


class Insurance(models.Model)

     _inherit = 'hr.insurance'

     name = fields.Char('Insurance')


Now you can inherit hr employee view and add in it.

<record id="social_insurance_tab" model="ir.ui.view">
     <field name="name">social.insurance.tab'</field>

     <field name="model">hr.employeefield>

    <field name='inherit_id' ref='hr.view_employee_form'></field>

    <field name='arch' type='xml'>

        <data>

             <xpath expr="//notebook" position="inside">

                     <page string='Insurance'>

                             <field name='insurance_id'></field>

                      </page>

             </xpath>

        </data>

     </field>

</record>


Hope this will helps you.

Thanks,

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 11/22/16, 5:48 AM
Seen: 438 times
Last updated: 6/9/17, 8:07 AM