Skip to Content
Menú
This question has been flagged
1 Respondre
7289 Vistes

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
Descartar
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
Descartar
Related Posts Respostes Vistes Activitat
1
de març 20
3672
12
de des. 18
35051
1
de jul. 16
7232
2
de març 15
6128
1
de març 15
3791