Skip to Content
Menu
This question has been flagged
1 Reply
3142 Views

we use odoo 11.

I don't want to update the base module(hr.employee)

I want add field attachment file to form employee.


customemodule.py:


class hr_custom(models.Model):   

 _name = 'hr_custom'   

 _inherit = 'hr.employee'
 attachment_ids = fields.Many2many('ir.attachment', 'attachment_id', string="Attachments")


view.xml:

<record id="view_hr_employee_form_inherit" model="ir.ui.view">        

    <field name="name">hr.employee.form.inherit</field>         

   <field name="model"> hr_custom </field>         

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

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

  <xpath expr="//page[1]" position="inside">          

          <group>                  

      <field name="attachment_ids"/>     

           </group>      

    </xpath>        

    </field> 

</record> 






Avatar
Discard
Author

Hi Avinash, thanks,

but error: Field `attachment_ids` does not exist.

You restart the server and upgrade the module?

Author

Excuse me,fixed . thanks a lot

My Pleasure

How to use inheritance in Odoo: https://goo.gl/4Zyc9d

Best Answer

Hello,

Remove _name = 'hr_custom'

Instead of <field name="model"> hr_custom </field>  put  <field name="model">hr.employee</field>


Thanks & Regards

Avinash N K

Avatar
Discard