تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
3851 أدوات العرض

By default I have installed 2 email templates for invoices:

Invoice Notification Email (applies to Message)

and

Invoice - Send by Email (applies to Invoice)

when I click Send by Mail from the invoice form view I see the template Invoice - Send by Email but the recipients receive template Invoice Notification Email

I have no failed mails in the outgoing server. This seems pretty confusing to me. Can someone explain me this behavior?

الصورة الرمزية
إهمال
أفضل إجابة

Hello Magen,

Here is Posibillity

1) Because of In Both Email Template Same Class Used May be that was creating Problem To Chose Right one During Send Mail.

Solution ::

You can Define Your Own Custom Sending Mail Function On Button and Send Mail using That, and Use Template Which you want to send.

@api.modeldef send_mail_to_partner(self):    
    picking_ids = self.env['stock.picking'].search([])
    for pick in picking_ids:
        ir_model_data = self.env['ir.model.data']
        try:
            template_id = email_temp.id
        except ValueError:
            template_id = False
        temp = self.env.ref('MODULE_NAME.EMAIL_TEMPLATE_NAME')
        self.env['mail.template'].browse(temp.id).send_mail(pick.id, force_send=True, raise_exception=True)
<button name="send_mail_to_partner" type="object" string="Send Mail" class="oe_highlight"/>
الصورة الرمزية
إهمال
الكاتب

What do you mean that the same Class was used? The model_id of one template is mail.message and of the other - account.invoice. And this is installed by default with accounting App so there should be some better solution or explanation of what is happening.

المنشورات ذات الصلة الردود أدوات العرض النشاط
2
يناير 25
1193
0
فبراير 18
3202
0
ديسمبر 21
3091
1
ديسمبر 20
4299
3
أكتوبر 18
5496