Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
7119 Vizualizări

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
Imagine profil
Abandonează
Cel mai bun răspuns

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
Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
1
mar. 20
3392
12
dec. 18
34696
1
iul. 16
7016
2
mar. 15
5889
1
mar. 15
3660