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

Hello,

I want to use crm.lead model's view crm.crm_case_form_view_oppor in my custome view. but when i change this view then it affect on original view.

How to do it. i don't know much about it. but i have tried. Can anyone help me.

- class that i have created:
class crm_lead(models.Model):
    _inherit = 'crm.lead'
    loanType_id = fields.Many2one('loan.type', "Type")
    duration = fields.Char("Durantion")

- view file
    <record model="ir.ui.view" id="crm_lead_inherited_form_view">
      <field name="name">Lead Form View</field>
      <field name="model">crm.lead</field>
      <field name="arch" type="xml">
        <form>
            <group>
                <field name="loanType_id" string="Loan Type" placeholder="Select loan type"/>
            </group>
        </form>
      </field>
    </record>

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

    <menuitem 
        name="Loan Management" 
        id="root_menu" />

    <menuitem 
        name="Lead" 
        id="menu_lead" 
        action="action_for_lead_views" 
        parent="root_menu"
        sequence="1" />

actually i want crm.crm_case_form_view_oppor view in my custom view and remove some fields of it and add some custom fields. but i do this it affect on custom and base view also.
How to Solve??

Thanks in advance
Avatar
Discard
Best Answer

Hi Haresh,

In your view file in the form view record you just missed the inherit_id 

<record model="ir.ui.view" id="crm_lead_inherited_form_view">
      <field name="name">Lead Form View</field>
      <field name="model">crm.lead</field>

      <field name="inherit_id" ref="crm.crm_case_form_view_oppor"/>
      <field name="arch" type="xml">
        <form>
            <group>
                <field name="loanType_id" string="Loan Type" placeholder="Select loan type"/>
            </group>
        </form>
      </field>
    </record>

By the above view I given in that inherit_id field is added so that only it should affect the oridinal view
Avatar
Discard
Related Posts Replies Views Activity
1
Mar 20
1990
12
Dec 18
32527
1
Jul 16
5608
2
Mar 15
4603
1
Mar 15
2708