From db5e6a124ab0c5dfd2411e8c6098ddae83ec3370 Mon Sep 17 00:00:00 2001 From: Damien Bouvy Date: Fri, 27 Nov 2015 15:55:53 +0100 Subject: [PATCH] [IMP] website_quote: mail template on a quote template for confirmation --- .../data/website_quotation_data.xml | 56 +++++++++++++++++++ addons/website_quote/models/order.py | 8 +++ .../views/website_quotation_backend.xml | 7 ++- 3 files changed, 70 insertions(+), 1 deletion(-) diff --git a/addons/website_quote/data/website_quotation_data.xml b/addons/website_quote/data/website_quotation_data.xml index dad2943b709..392bb501139 100644 --- a/addons/website_quote/data/website_quotation_data.xml +++ b/addons/website_quote/data/website_quotation_data.xml @@ -103,5 +103,61 @@ + + Website Quote: confirmation e-mail + ${(object.user_id.email or object.company_id.email or 'noreply@localhost')|safe} + Your order ${object.name} is confirmed + ${ctx.get('email_to') or object.partner_id.email} + + + + + + +
+ ${user.company_id.name} +
+ + + + +
+
+
+
+
+ +
+ + + + + + +
+

Dear ${object.partner_id.name},


+

Your order ${object.name} has been validated!


+ + % if object.partner_id.user_ids +

You can view your quotes, sales orders and invoices online by going to our Online Portal.


+ % endif + +

If you have any question, do not hesitate to contact us.


+

Thank you for choosing ${object.company_id.name or "us"}!

+
+ % if user.signature +

${user.signature | safe} +

+ % endif +

Sent by + + ${user.company_id.name} + using Odoo +

+
+
]]>
+
+ diff --git a/addons/website_quote/models/order.py b/addons/website_quote/models/order.py index ddf212b1911..4ac152d5f2a 100644 --- a/addons/website_quote/models/order.py +++ b/addons/website_quote/models/order.py @@ -27,6 +27,7 @@ class sale_quote_template(osv.osv): (0, 'Not mandatory on website quote validation'), (1, 'Immediate after website order validation') ], 'Payment', help="Require immediate payment by the customer when validating the order from the website quote"), + 'mail_template_id': fields.many2one('mail.template', 'Confirmation Mail', help="This e-mail template will be sent on confirmation. Leave empty to send nothing.") } def open_template(self, cr, uid, quote_id, context=None): return { @@ -293,6 +294,13 @@ class sale_order(osv.osv): values = dict(template_values, **values) return super(sale_order, self).create(cr, uid, values, context=context) + def action_confirm(self, cr, uid, ids, context=None): + res = super(sale_order, self).action_confirm(cr, uid, ids, context=context) + for order in self.browse(cr, uid, ids, context=context): + if order.template_id and order.template_id.mail_template_id: + self.pool['mail.template'].send_mail(cr, uid, order.template_id.mail_template_id.id, order.id, context=context) + return res + class sale_quote_option(osv.osv): _name = "sale.quote.option" diff --git a/addons/website_quote/views/website_quotation_backend.xml b/addons/website_quote/views/website_quotation_backend.xml index da9aeea0be6..b64a1e8c06c 100644 --- a/addons/website_quote/views/website_quotation_backend.xml +++ b/addons/website_quote/views/website_quotation_backend.xml @@ -62,7 +62,6 @@
days
- @@ -118,6 +117,12 @@ + + + + + +