I created a new field in the crm.lead template and I want to increment the context of the button responsible for generating the quotation from the opportunity.
https://github.com/odoo/odoo/blob/2569bcc11d5dfc0e09adc3495ca51aefdd375f70/addons/sale_crm/views/crm_lead_views.xml#L9
So far I have created the field in the models crm.lead and sale.order
class CrmLead(models.Model):
_inherit = 'crm.lead'
vehicle_id = fields.Many2one("workshop.vehicle", string="Vehicle")
class SaleOrder(models.Model):
_inherit = 'sale.order'
vehicle_id = fields.Many2one("workshop.vehicle", string="Vehicle")
And managed to take the value of vehicle id to the sales order. However, overwriting the whole context of the button responsible for the quote generation.
<record id="workshop_vehicle_crm_opportunity_form_view_inherit" model="ir.ui.view">
<field name="name">workshop.vehicle.crm.opportunity.form.inherit</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_case_form_view_oppor"/>
<field name="arch" type="xml">
<button name='%(sale_crm.sale_action_quotations_new)d' position='attributes'>
<attribute name="context">{
'search_default_partner_id': partner_id,
'default_partner_id': partner_id,
'default_team_id': team_id,
'default_campaign_id': campaign_id,
'default_medium_id': medium_id,
'default_source_id': source_id,
'default_vehicle_id': vehicle_id,
}
</attribute>
</button>
<xpath expr="//field[@name='partner_id']" position="after">
<field name="vehicle_id" string="Vehicle"/>
</xpath>
</field>
</record>
Is it possible to just increment the context of this button in the module sale_crm?
Thanks,