Ir al contenido
Menú
Se marcó esta pregunta
4029 Vistas

I need to make a many2many relationship between leads and customers. I successfully did that and also I would like to add additional params to context for button "Meetings" only when called from Lead.

My Code is below

<record model="ir.ui.view" id="view_partner_form_custom">
    <field name="name">res.partner.form</field>
    <field name="model">res.partner</field>
    <field name="inherit_id" ref="base.view_partner_form" />
    <field name="arch" type="xml">
<xpath expr="//button[@string='Meetings']" position="attributes">
      <attribute name="context">{'search_default_partner_ids': active_id, 'default_partner_ids' : [active_id], 'search_default_lead_id': context.get('lead_id'), 'default_lead_id': context.get('lead_id')}</attribute>
</xpath>
</field>
</record>

The above code works fine and when clicking on meeting button in lead -> customer form -> meetings button but not working fine when clicking on customer form -> Meetings button

And i get the below error

TypeError: val is null

I could see that the below lines are problematic

'search_default_lead_id': context.get('lead_id'), 'default_lead_id': context.get('lead_id')

But the default search from lead for meetings should be based on that particular lead and customer id. Kindly clarify. Also feel free to update the post for better clarity. Thanks

Avatar
Descartar

(Please post your question only once. I had to delete 4 other versions of this question)

Autor

(Hey i am really sorry, i got 404 error on posting, so just clicked on page refresh. extremely sorry about it)