This question has been flagged
1 Reply
7785 Views

I create a new class fleet_agent that inherits from res.partner without problems

class fleet_agent(osv.Model): 
_name = 'fleet.agent' _inherit = ['res.partner'] _columns = { 'test': fields.char('Test', help='Test'),
}

then fleet_agent_form inherits base.view_partner_form also no problem

<record id="fleet_agent_form" model="ir.ui.view"> 
<field name="name">fleet.agent.form</field> <field name="model">fleet.agent</field> <field name="inherit_id" ref="base.view_partner_form" /> <field name="arch" type="xml"> <field name="state_id" position="before"> <field name="x" /> </field> </field>
</record>

My problem is that this form does not appear as the formatting of view_partner_form and with all fields without any order ?

Avatar
Discard
Best Answer

Hello mehdi,

These are the standard rules for inheriting view in odoo frameworks.

1) When you are inheriting any view you can only add those fields are added in the same model.

>> In your case you have created new model, it means your field should be inside the partner model. but you have your own model fleet.agent.

If you just want to add columns in partner view than you don't need to create your own model just inherit the existing one (res.partner) in py file and use the inheritance for res.partner model.

2) If you want to create your own model by inheriting the existing one model in that case create your own view with all fields those you want to display for your new model.

Suggestion: If you just want to append few fields on res.partner existing one view than follow like this.

Sample code :

    _inherit = 'res.partner'

    _columns = {

    your custom fields

    }

    Now these fields will be able to append in the existing view ,which have already applied from your side.


Regards,

Anil.

Avatar
Discard