Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
4146 Lượt xem

I would like to change the default recipient on the Invoice: Sending template to myself so that customers aren't accidentally sent invoices that they shouldn't receive. I have tried simply adding my information to the email template "To (Emails)" and "To (Partners)" fields, but the invoices are still sent to the customer's email address. I may not be formatting the information correctly, I'm not sure.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,
You can change the To address from the settings.  Enable developer mode and navigate to Settings -> Technical -> Email -> Email Templates.

Now search and open the template named "Invoice: Sending" , switch to Email Configuration page and clear the value in the To (Partners) field and set your email id in  To (Emails) field.




Now if the Send button is clicked in the invoice, Email will be sent to this email-id





Thanks

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

You can add the below code to change the email to in the invoice. 

For that create a custom model by inhering the model mail.mail, and add below function in it.

@api.model_create_multi

    def create(self, values_list):

        new_mails = super(MailMail, self).create(values_list)

        if new_mails.model == "account.move":

            for recipient_id in new_mails.recipient_ids:

                if recipient_id:

                    if recipient_id.invoice_email:

                        new_mails.email_to = f' "{recipient_id.name}" '

                        new_mails.recipient_ids = [

                            (5, 0, 0)]

        return new_mails



The above code is only applicable for invoices, if you need to achieve this for all you can remove the condition of checking the model "account.move".


Note: replace the field "invoice_email" with your new mail field 


Hope it helps

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

I've tried this, and even though my information shows up exactly like in your screenshot, the invoice is still sent to the customer. I turned off the auto-delete in the invoice template so that I could see what was happening on the back-end, and the customer's information still populates in the "To (Partners)" field.

Ảnh đại diện
Huỷ bỏ

then it may getting added up from the followers of the record

Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 2 18
7597
0
thg 4 23
3076
7
thg 12 23
34012
1
thg 4 20
6564
2
thg 5 19
6557