diff --git a/payment_proof_attachment/controllers/payment_proof_attachment.py b/payment_proof_attachment/controllers/payment_proof_attachment.py index 12f6d5444..cfeb4cf1d 100755 --- a/payment_proof_attachment/controllers/payment_proof_attachment.py +++ b/payment_proof_attachment/controllers/payment_proof_attachment.py @@ -57,7 +57,8 @@ class WebsitePaymentProof(http.Controller): sale_id = request.session.sale_order_id sale = request.env['sale.order'].sudo().browse(sale_id) for attachment in kw['attachments']: - payment_proof_attachment = request.env['ir.attachment'].sudo().create({ + payment_proof_attachment = request.env[ + 'ir.attachment'].sudo().create({ 'name': attachment['name'], 'res_model': 'sale.order', 'res_id': sale_id, @@ -66,14 +67,18 @@ class WebsitePaymentProof(http.Controller): 'datas': attachment['content'], }) body = _("%s document is added by %s" % ( - attachment['name'], request.env.user.name)) + attachment['name'], request.env.user.name)) sale.message_post(body=body) - mail_template = request.env.ref('payment_proof_attachment.payment_proof_attachment_email_template').id + copied_attachment = payment_proof_attachment.copy() + + mail_template = request.env.ref( + 'payment_proof_attachment' + '.payment_proof_attachment_email_template').id template = request.env['mail.template'].browse(mail_template) - template.attachment_ids = [(6, 0, [payment_proof_attachment.id])] + template.attachment_ids = [(6, 0, [copied_attachment.id])] template.send_mail(sale_id, force_send=True) - template.attachment_ids = [(3, payment_proof_attachment.id)] - return + template.attachment_ids = [(3, copied_attachment.id)] + return True @http.route(['/my_account_screen/show_updated'], type='json', auth="public") def payment_show_receipt(self, **kw): diff --git a/payment_proof_attachment/data/payment_proof_attachment.xml b/payment_proof_attachment/data/payment_proof_attachment.xml index 6bed3f7bb..cbf09725f 100644 --- a/payment_proof_attachment/data/payment_proof_attachment.xml +++ b/payment_proof_attachment/data/payment_proof_attachment.xml @@ -1,18 +1,25 @@ - + Sales Order: Payment Proof Attachment Payment Proof Attachment - {{ (object.user_id.email_formatted or user.email_formatted or '') }} + {{ (object.user_id.email_formatted or + user.email_formatted or '') }} + {{ object.partner_id.id }}
-

Dear,

-

Your Payment Proof Attachment is Uploaded Successfully

+ Dear, + +

Your Payment Proof Attachment is Uploaded Successfully +

Best regards,

-

{{ object.company_id.id }}

+ + +
{{ object.partner_id.lang }} diff --git a/payment_proof_attachment/static/src/js/my_account_screen.js b/payment_proof_attachment/static/src/js/my_account_screen.js index 933010163..bc45fb66f 100755 --- a/payment_proof_attachment/static/src/js/my_account_screen.js +++ b/payment_proof_attachment/static/src/js/my_account_screen.js @@ -75,7 +75,7 @@ odoo.define('payment_proof_attachment.my_account_screen', function(require) { $(attachment_ids).each(function(attachment_id) { var id = "/web/content/" + attachment_ids[attachment_id]['id'] var name = attachment_ids[attachment_id]['name'] - self.$el.find('#showing_updated_receipt').append("" + name + "
"); + self.$el.find('#showing_updated_receipt').append("" + name + "
"); }); } else { self.$el.find("#showing_updated_receipt").empty(); diff --git a/payment_proof_attachment/static/src/js/payment_screen.js b/payment_proof_attachment/static/src/js/payment_screen.js index 4fdfa6e1b..3e1b53129 100755 --- a/payment_proof_attachment/static/src/js/payment_screen.js +++ b/payment_proof_attachment/static/src/js/payment_screen.js @@ -73,7 +73,7 @@ odoo.define('payment_proof_attachment.payment_screen', function(require) { $(attachment_ids).each(function(attachment_id) { var id = "/web/content/" + attachment_ids[attachment_id]['id'] var name = attachment_ids[attachment_id]['name'] - self.$el.find('#showing_updated_receipt').append("" + name + "
"); + self.$el.find('#showing_updated_receipt').append("" + name + "
"); }); } else { self.$el.find("#showing_updated_receipt").empty();