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

Add custom field to partner model

Avatar
Discard
Best Answer

Hi,

If you just want to add a new field to the res.partner model inheit the class in Python and add the field.


ClassResPartner(models.Model):

_inherit = 'res.partner'

field_new = fields.Char('field')

And to add it to the view you can use xpath,  this is a sample one,


<record id="view_partner_form" model="ir.ui.view">
            <field name="name">res.partner.form</field>
            <field name="model">res.partner</field>
            <field name="inherit_id" ref="base.view_partner_form"/>
            <field name="archh" type="xml">
                <field name="a_field_name" position="after">
<field name="field_new"/>
</field> </field> </record>


Thanks

Avatar
Discard