콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다

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

아바타
취소
관련 게시물 답글 화면 활동
0
8월 22
6061
2
6월 24
9547
0
4월 20
2061
2
10월 17
4645
8
7월 24
23903