Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
1 Vastaa
3094 Näkymät

HI.

I want to know inside sales quotations, how to contect sale_order_template_id (quotation template) with use template ( from mail.template) in a way that if I select one quotation template then gets an specific  mail template.

Im willing to do it on python code but im a little lost,

 any help is well received;

Avatar
Hylkää
Paras vastaus

Hi,

Override the action_quotation_send function and pass the required mail template with condition of selected quotation template.

def action_quotation_send(self):
self.ensure_one()
if self.sale_order_template_id.id == 'condition':
template_id = self._find_mail_template()# select the required mail template id
lang = self.env.context.get('lang')
template = self.env['mail.template'].browse(template_id)
template.attachment_ids.unlink()
if template.lang:
lang = template._render_lang(self.ids)[self.id]
ctx = {
'default_model': 'sale.order',
'default_res_id': self.ids[0],
'default_use_template': bool(template_id),
'default_template_id': template_id,
'default_composition_mode': 'comment',
'mark_so_as_sent': True,
'custom_layout': "mail.mail_notification_paynow",
'proforma': self.env.context.get('proforma', False),
'force_email': True,
'model_description': self.with_context(lang=lang).type_name,
'default_attachment_name': [(6, 0, self.designer_attachment_ids.ids)]
}
return {
'type': 'ir.actions.act_window',
'view_mode': 'form',
'res_model': 'mail.compose.message',
'views': [(False, 'form')],
'view_id': False,
'target': 'new',
'context': ctx,
}

Regards

Avatar
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
0
elok. 22
5733
2
kesäk. 24
9194
0
huhtik. 20
1866
2
lokak. 17
4387
8
heinäk. 24
23197