Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
3110 มุมมอง

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;

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ส.ค. 22
5756
2
มิ.ย. 24
9217
0
เม.ย. 20
1869
2
ต.ค. 17
4404
8
ก.ค. 24
23270