[IMP] website_quote: mail template on a quote template for confirmation
This commit is contained in:
@@ -103,5 +103,61 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="confirmation_mail" model="mail.template">
|
||||
<field name="name">Website Quote: confirmation e-mail</field>
|
||||
<field name="email_from">${(object.user_id.email or object.company_id.email or 'noreply@localhost')|safe}</field>
|
||||
<field name="subject">Your order ${object.name} is confirmed</field>
|
||||
<field name="email_to">${ctx.get('email_to') or object.partner_id.email}</field>
|
||||
<field name="model_id" ref="sale.model_sale_order"/>
|
||||
<field name="body_html"><![CDATA[
|
||||
<div summary="o_mail_template" style="padding:0px; width:600px; margin:0 auto; background: #FFFFFF repeat top /100%;color:#777777">
|
||||
<table cellspacing="0" cellpadding="0" style="width:600px; border-collapse:collapse; background:inherit; color:inherit">
|
||||
<tbody><tr>
|
||||
<td valign="center" width="200" style="padding:0px 10px 5px 5px;font-size: 12px">
|
||||
<img src="/logo.png" style="padding: 0px; margin: 0px; height: auto; width: 80px;" alt="${user.company_id.name}">
|
||||
</td>
|
||||
</tr></tbody>
|
||||
</table>
|
||||
<table cellspacing="0" cellpadding="0" style="width:600px; border-collapse:collapse; background:inherit; color:inherit">
|
||||
<tbody><tr>
|
||||
<td valign="top" style="width:600px; padding:0px 10px 5px 5px;">
|
||||
<div>
|
||||
<hr width="100%" style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0;margin:15px auto;padding:0">
|
||||
</div>
|
||||
</td>
|
||||
</tr></tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div style="padding:0px; width:600px; max-width:600px; margin:0 auto; background: #FFFFFF repeat top /100%;color:#777777">
|
||||
<table cellspacing="0" cellpadding="0" style="width:600px ;text-align:justify; margin:0 auto; border-collapse:collapse; background:inherit; color:inherit">
|
||||
<tbody><tr>
|
||||
<td style="padding:0px 10px 5px 5px;font-size: 14px;">
|
||||
<p>Dear ${object.partner_id.name},</p><br/>
|
||||
<p>Your order <a href="/quote/${object.id}/${object.access_token}">${object.name}</a> has been validated!</p><br/>
|
||||
|
||||
% if object.partner_id.user_ids
|
||||
<p>You can view your quotes, sales orders and invoices online by going to our <a style="text-decoration:none; color: #a24689;" href="/my/home">Online Portal</a>.</p><br/>
|
||||
% endif
|
||||
|
||||
<p>If you have any question, do not hesitate to contact us.</p><br/>
|
||||
<p>Thank you for choosing ${object.company_id.name or "us"}!</p>
|
||||
</td>
|
||||
</tr><tr>
|
||||
<td style="padding:0px 10px 5px 5px;font-size: 14px;">
|
||||
% if user.signature
|
||||
<p style="font-size: 14px;">${user.signature | safe}
|
||||
</p>
|
||||
% endif
|
||||
<p style="font-size: 11px;"><strong>Sent by
|
||||
<a href="${user.company_id.website}" style="text-decoration:none; color: #a24689;">
|
||||
<strong>${user.company_id.name}</strong>
|
||||
</a> using <a href="www.odoo.com" style="text-decoration:none; color: #a24689;"><strong>Odoo</strong></a>
|
||||
</strong></p>
|
||||
</td>
|
||||
</tr></tbody>
|
||||
</table>
|
||||
</div>]]></field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -62,7 +62,6 @@
|
||||
<div id="number_of_days">
|
||||
<field name="number_of_days" class="oe_inline"/> days
|
||||
</div>
|
||||
<field name="require_payment" widget="radio"/>
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
@@ -118,6 +117,12 @@
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page string="Other Settings">
|
||||
<group>
|
||||
<field name="require_payment" widget="radio"/>
|
||||
<field name="mail_template_id"/>
|
||||
</group>
|
||||
</page>
|
||||
</notebook>
|
||||
<field name="website_description" invisible="1"/>
|
||||
<field name="note" placeholder="An administrator can set up default Terms and conditions in your Company settings." nolabel="1"/>
|
||||
|
||||
Reference in New Issue
Block a user