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

I am trying to customize the crm lead object. Class is defined this way

class yvleads(models.Model):
_inherit = 'crm.lead'
_name = 'crm.lead'

Now I added a menu item to display the added elements for which I have both a tree view and a form view. I have added a lett menu item referening a ir.actions.act_window. When this action is defined as

 <record model="ir.actions.act_window" id="yvleads_mgt">
     <field name="name">Leads Yves</field>
     <field name="res_model">crm.lead</field>
     <field name="view_type">form</field>
     <field name="view_mode">form,tree</field>
     <field name="view_id" ref="tree_view_yves_leads"/>
</record>

this works fine for the list-tree view but when I click on any item or the create button, I get the default form view for crm.

To add my customized view for form also, my understanding of [odoo documentation](https://www.odoo.com/documentation/8.0/reference/actions.html#notquitem2m) is that I should use view_ids element but I was not able to get it right

I have tried several syntaxes with/without brackets, using eval="" or inside the xml definition but with no success. Searching this forum for string name="view_ids" was not very helfull, may be it is not the best practice to do that? any help appreciated

 <record model="ir.actions.act_window" id="yvleads_mgt">
     <field name="name">Leads Yves</field>
     <field name="res_model">crm.lead</field>
     <field name="view_type">form</field>
     <field name="view_mode">form,tree</field>
     <field name="view_ids">(tree,tree_view_yves_leads),(form,form_view_yves_leads)</field>
</record>


Avatar
Discard
Best Answer

Hello,

I think it is better to use ir.actions.act_window.view ...

You can check these lines ...

Regards

Avatar
Discard