inheritance - Inherit the existing view(view_partner_form) in my custom module -
i have inherit view_partner_form res.partner model in base module , need add fields @ contact form(view_partner_form) in custom module tried impact fields added correctly ui totally collapse
this python code:
class residents(models.model): _inherit = "res.partner" _name = "residents.details" f_no = fields.char() id_proof = fields.selection([('aadhar_card','aadhar card')],string = "id proof") id_no = fields.char(string = "id no")
xml code:
<record id = "add_field_view_partner_form" model = "ir.ui.view"> <field name = "name">add.fields</field> <field name = "model">residents.details</field> <field name = "inherit_id" ref = "base.view_partner_form"/> <field name = "arch" type = "xml"> <field name = "city" position="before"> <field name = "f_no" placeholder = "flat no"/> </field> <field name = "lang" position="after"> <field name = "id_proof" /> </field> <field name = "id_proof" position="after"> <field name = "id_no" /> </field> </field> </record>
update
pls find screenshot
first of screen shot form odoo generate , contains field in 2 columns layout. , odoo when model don't have form view @ all. smart odoo ^^.
here in same case when inherit view changed model name!!
<record id = "add_field_view_partner_form" model = "ir.ui.view"> <field name = "name">add.fields</field> <!-- should keep same name res.partners --> <!-- in code removed model name , lickly why lost the view , why odoo showing generated form view --> <field name = "model">residents.details</field> <field name = "inherit_id" ref = "base.view_partner_form"/> <field name = "arch" type = "xml">
Comments
Post a Comment