diff options
| author | Thibault Delavallée <tde@openerp.com> | 2015-10-28 18:10:09 +0100 |
|---|---|---|
| committer | Thibault Delavallée <tde@openerp.com> | 2015-11-02 11:51:09 +0100 |
| commit | 7fe9d58b0d890d714d690a5e17bd3ef31bcc47ba (patch) | |
| tree | 701174dd85a174be8b5adc12bc3cc72844d25e89 | |
| parent | b52069754dbfaefb77fdb5e2765de5273cc1381b (diff) | |
[IMP] invoice, sale, purchase: template update
Templates used to send invoice / quotation / PO by email are cleaned. Custom
style is removed. Content is simplified.
For sale, only one template is kept through the various addons. Previously to
this commit there are 3 templates: standard, portal and online quote. Those
template are similar except the link to get the sale order. Now the base template
contains some logic that should be sufficient to cover all cases. This breaks
the modular approach but is easier to use for users. As templates are still mako
it is not possible to use inheritance. So having a base template knowing some bits
of overriding modules is necessary if we want to avoid having the same template
duplicated.
| -rw-r--r-- | addons/account/data/invoice_action_data.xml | 77 | ||||
| -rw-r--r-- | addons/portal_sale/__openerp__.py | 1 | ||||
| -rw-r--r-- | addons/portal_sale/portal_sale.py | 26 | ||||
| -rw-r--r-- | addons/portal_sale/portal_sale_data.xml | 167 | ||||
| -rw-r--r-- | addons/purchase/data/mail_template_data.xml | 135 | ||||
| -rw-r--r-- | addons/sale/data/mail_template_data.xml | 81 | ||||
| -rw-r--r-- | addons/website_quote/data/website_quotation_data.xml | 145 | ||||
| -rw-r--r-- | addons/website_quote/models/order.py | 17 |
8 files changed, 91 insertions, 558 deletions
diff --git a/addons/account/data/invoice_action_data.xml b/addons/account/data/invoice_action_data.xml index e04a3517032..11ed429d417 100644 --- a/addons/account/data/invoice_action_data.xml +++ b/addons/account/data/invoice_action_data.xml @@ -16,58 +16,31 @@ <field name="report_name">Invoice_${(object.number or '').replace('/','_')}_${object.state == 'draft' and 'draft' or ''}</field> <field name="lang">${object.partner_id.lang}</field> <field name="body_html"><![CDATA[ -<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; "> - <p>Hello ${object.partner_id.name},</p> - <p>A new invoice is available for you: </p> - - <p style="border-left: 1px solid #8e0000; margin-left: 30px;"> - <strong>REFERENCES</strong><br /> - Invoice number: <strong>${object.number}</strong><br /> - Invoice total: <strong>${object.amount_total} ${object.currency_id.name}</strong><br /> - Invoice date: ${object.date_invoice}<br /> - % if object.origin: - Order reference: ${object.origin}<br /> - % endif - % if object.user_id: - Your contact: <a href="mailto:${object.user_id.email or ''}?subject=Invoice%20${object.number}">${object.user_id.name}</a> - % endif - </p> - - % if object.paypal_url: - <br/> - <p>It is also possible to directly pay with Paypal:</p> - <a style="margin-left: 120px;" href="${object.paypal_url}"> - <img class="oe_edi_paypal_button" src="/account/static/src/img/btn_paynowcc_lg.gif"/> - </a> - % endif - - <br/> - <p>If you have any question, do not hesitate to contact us.</p> - <p>Thank you for choosing ${object.company_id.name or 'us'}!</p> - <br/> - <br/> - <div style="width: 375px; margin: 0px; padding: 0px; background-color: #8E0000; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; background-repeat: repeat no-repeat;"> - <h3 style="margin: 0px; padding: 2px 14px; font-size: 12px; color: #DDD;"> - <strong style="text-transform:uppercase;">${object.company_id.name}</strong></h3> - </div> - <div style="width: 347px; margin: 0px; padding: 5px 14px; line-height: 16px; background-color: #F2F2F2;"> - <span style="color: #222; margin-bottom: 5px; display: block; "> - ${object.company_id.partner_id.sudo().with_context(show_address=True, html_format=True).name_get()[0][1] | safe} - </span> - % if object.company_id.phone: - <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "> - Phone: ${object.company_id.phone} - </div> - % endif - % if object.company_id.website: - <div> - Web : <a href="${object.company_id.website}">${object.company_id.website}</a> - </div> - %endif - <p></p> - </div> -</div> - ]]></field> +% set access_action = object.get_access_action() +% set access_name = 'View invoice' if access_action and access_action['type'] == 'ir.actions.act_url' else 'See invoice' +% set access_url = access_action['type'] == 'ir.actions.act_url' and access_action['url'] or '/report/pdf/account.report_invoice/' + str(object.id) + +<p>Dear +% if object.partner_id.company_type == 'company' and object.child_ids: + ${object.partner_id.child_ids[0].name} +% else : + ${object.partner_id.name} +% endif +,</p> +<p>Thank you for your inquiry. Here is your invoice <strong>${object.name}</strong> +% if object.origin: +(with reference: ${object.origin} ) +% endif +amounting <strong>${object.amount_total} ${object.currency_id.name}</strong> +from ${object.company_id.name}. +</p> + +<p style="margin-left: 30px;"> + <a href="${access_url}" style="padding: 5px 10px; font-size: 12px; line-height: 18px; color: #FFFFFF; border-color:#a24689; text-decoration: none; display: inline-block; margin-bottom: 0px; font-weight: 400; text-align: center; vertical-align: middle; cursor: pointer; white-space: nowrap; background-image: none; background-color: #a24689; border: 1px solid #a24689; border-radius:3px" class="o_default_snippet_text">${access_name}</a> +</p> +<p>If you have any question, do not hesitate to contact us.</p> +<p>Best regards,</p> +]]></field> </record> </data> </openerp> diff --git a/addons/portal_sale/__openerp__.py b/addons/portal_sale/__openerp__.py index aaf13bbca44..1ea72f45e77 100644 --- a/addons/portal_sale/__openerp__.py +++ b/addons/portal_sale/__openerp__.py @@ -29,7 +29,6 @@ by default, you simply need to configure a Paypal account in the Accounting/Invo 'data': [ 'security/portal_security.xml', 'portal_sale_view.xml', - 'portal_sale_data.xml', 'security/ir.model.access.csv', ], 'auto_install': True, diff --git a/addons/portal_sale/portal_sale.py b/addons/portal_sale/portal_sale.py index c422c7ac57e..0c071e1c37d 100644 --- a/addons/portal_sale/portal_sale.py +++ b/addons/portal_sale/portal_sale.py @@ -9,19 +9,6 @@ from openerp import SUPERUSER_ID class sale_order(osv.Model): _inherit = 'sale.order' - def action_quotation_send(self, cr, uid, ids, context=None): - ''' Override to use a modified template that includes a portal signup link ''' - action_dict = super(sale_order, self).action_quotation_send(cr, uid, ids, context=context) - try: - template_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'portal_sale', 'email_template_edi_sale')[1] - # assume context is still a dict, as prepared by super - ctx = action_dict['context'] - ctx['default_template_id'] = template_id - ctx['default_use_template'] = True - except Exception: - pass - return action_dict - def action_confirm(self, cr, uid, ids, context=None): # fetch the partner's id and subscribe the partner to the sale order assert len(ids) == 1 @@ -52,19 +39,6 @@ class sale_order(osv.Model): class account_invoice(osv.Model): _inherit = 'account.invoice' - def action_invoice_sent(self, cr, uid, ids, context=None): - ''' Override to use a modified template that includes a portal signup link ''' - action_dict = super(account_invoice, self).action_invoice_sent(cr, uid, ids, context=context) - try: - template_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'portal_sale', 'email_template_edi_invoice')[1] - # assume context is still a dict, as prepared by super - ctx = action_dict['context'] - ctx['default_template_id'] = template_id - ctx['default_use_template'] = True - except Exception: - pass - return action_dict - def invoice_validate(self, cr, uid, ids, context=None): # fetch the partner's id and subscribe the partner to the invoice for invoice in self.browse(cr, uid, ids, context=context): diff --git a/addons/portal_sale/portal_sale_data.xml b/addons/portal_sale/portal_sale_data.xml deleted file mode 100644 index 0b4a0246f3e..00000000000 --- a/addons/portal_sale/portal_sale_data.xml +++ /dev/null @@ -1,167 +0,0 @@ -<openerp> - <!-- Mail template is done in a NOUPDATE block - so users can freely customize/delete them --> - <data noupdate="1"> - - <!--Email template --> - <record id="email_template_edi_sale" model="mail.template"> - <field name="name">Sales Order - Send by Email (Portal)</field> - <field name="email_from">${(object.user_id.email or '')|safe}</field> - <field name="subject">${object.company_id.name|safe} ${object.state in ('draft', 'sent') and 'Quotation' or 'Order'} (Ref ${object.name or 'n/a' })</field> - <field name="partner_to">${object.partner_invoice_id.id}</field> - <field name="model_id" ref="sale.model_sale_order"/> - <field name="auto_delete" eval="True"/> - <field name="report_template" ref="sale.report_sale_order"/> - <field name="report_name">${(object.name or '').replace('/','_')}_${object.state == 'draft' and 'draft' or ''}</field> - <field name="lang">${object.partner_id.lang}</field> - <field name="user_signature" eval="True"/> - <field name="body_html"><![CDATA[ -<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: rgb(255, 255, 255); "> - - <p>Hello ${object.partner_id.name},</p> - - <p>Here is your ${object.state in ('draft', 'sent') and 'quotation' or 'order confirmation'} from ${object.company_id.name}: </p> - - <p style="border-left: 1px solid #8e0000; margin-left: 30px;"> - <strong>REFERENCES</strong><br /> - Order number: <strong>${object.name}</strong><br /> - Order total: <strong>${object.amount_total} ${object.pricelist_id.currency_id.name}</strong><br /> - Order date: ${format_tz(object.date_order, tz=user.tz, context={'lang':object.partner_id.lang})}<br /> - % if object.validity_date and object.state in ('draft', 'sent'): - Expiration date: ${object.validity_date}<br /> - % endif - % if object.origin: - Order reference: ${object.origin}<br /> - % endif - % if object.client_order_ref: - Your reference: ${object.client_order_ref}<br /> - % endif - % if object.user_id: - Your contact: <a href="mailto:${object.user_id.email or ''}?subject=Order%20${object.name}">${object.user_id.name}</a> - % endif - </p> - - <% set signup_url = object.get_signup_url() %> - % if signup_url and object.amount_total > 0 : - <p> - You can access this document and pay online via our Customer Portal: - </p> - <a style="display:block; width: 150px; height:20px; margin-left: 120px; color: #DDD; font-family: 'Lucida Grande', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: bold; text-align: center; text-decoration: none !important; line-height: 1; padding: 5px 0px 0px 0px; background-color: #8E0000; border-radius: 5px 5px; background-repeat: repeat no-repeat;" - href="${signup_url}">View ${object.state in ('draft', 'sent') and 'Quotation' or 'Order'}</a> - % endif - - % if object.paypal_url and object.amount_total > 0 : - <br/> - <p>It is also possible to directly pay with Paypal:</p> - <a style="margin-left: 120px;" href="${object.paypal_url}"> - <img class="oe_edi_paypal_button" src="/sale/static/img/btn_paynowcc_lg.gif"/> - </a> - % endif - - <br/> - <p>If you have any question, do not hesitate to contact us.</p> - <p>Thank you for choosing ${object.company_id.name or 'us'}!</p> - <br/> - <br/> - <div style="width: 375px; margin: 0px; padding: 0px; background-color: #8E0000; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; background-repeat: repeat no-repeat;"> - <h3 style="margin: 0px; padding: 2px 14px; font-size: 12px; color: #DDD;"> - <strong style="text-transform:uppercase;">${object.company_id.name}</strong></h3> - </div> - <div style="width: 347px; margin: 0px; padding: 5px 14px; line-height: 16px; background-color: #F2F2F2;"> - <span style="color: #222; margin-bottom: 5px; display: block; "> - ${object.company_id.partner_id.sudo().with_context(show_address=True, html_format=True).name_get()[0][1] | safe} - </span> - % if object.company_id.phone: - <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "> - Phone: ${object.company_id.phone} - </div> - % endif - % if object.company_id.website: - <div> - Web : <a href="${object.company_id.website}">${object.company_id.website}</a> - </div> - % endif - <p></p> - </div> -</div> - ]]></field> - </record> - - <record id="email_template_edi_invoice" model="mail.template"> - <field name="name">Invoice - Send by Email (Portal)</field> - <field name="email_from">${(object.user_id.email or object.company_id.email or 'noreply@localhost')|safe}</field> - <field name="subject">${object.company_id.name|safe} Invoice (Ref ${object.number or 'n/a' })</field> - <field name="partner_to">${object.partner_id.id}</field> - <field name="model_id" ref="account.model_account_invoice"/> - <field name="auto_delete" eval="True"/> - <field name="report_template" ref="account.account_invoices"/> - <field name="report_name">Invoice_${(object.number or '').replace('/','_')}_${object.state == 'draft' and 'draft' or ''}</field> - <field name="lang">${object.partner_id.lang}</field> - <field name="body_html"><![CDATA[ -<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: rgb(255, 255, 255); "> - - <p>Hello ${object.partner_id.name},</p> - - <p>A new invoice is available for you: </p> - - <p style="border-left: 1px solid #8e0000; margin-left: 30px;"> - <strong>REFERENCES</strong><br /> - Invoice number: <strong>${object.number}</strong><br /> - Invoice total: <strong>${object.amount_total} ${object.currency_id.name}</strong><br /> - Invoice date: ${object.date_invoice}<br /> - % if object.origin: - Order reference: ${object.origin}<br /> - % endif - % if object.user_id: - Your contact: <a href="mailto:${object.user_id.email or ''}?subject=Invoice%20${object.number}">${object.user_id.name}</a> - % endif - </p> - - <% set signup_url = object.get_signup_url() %> - % if signup_url: - <p> - You can access the invoice document and pay online via our Customer Portal: - </p> - <a style="display:block; width: 150px; height:20px; margin-left: 120px; color: #DDD; font-family: 'Lucida Grande', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: bold; text-align: center; text-decoration: none !important; line-height: 1; padding: 5px 0px 0px 0px; background-color: #8E0000; border-radius: 5px 5px; background-repeat: repeat no-repeat;" - href="${signup_url}">View Invoice</a> - % endif - - % if object.paypal_url: - <br/> - <p>It is also possible to directly pay with Paypal:</p> - <a style="margin-left: 120px;" href="${object.paypal_url}"> - <img class="oe_edi_paypal_button" src="/sale/static/img/btn_paynowcc_lg.gif"/> - </a> - % endif - - <br/> - <p>If you have any question, do not hesitate to contact us.</p> - <p>Thank you for choosing ${object.company_id.name or 'us'}!</p> - <br/> - <br/> - <div style="width: 375px; margin: 0px; padding: 0px; background-color: #8E0000; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; background-repeat: repeat no-repeat;"> - <h3 style="margin: 0px; padding: 2px 14px; font-size: 12px; color: #DDD;"> - <strong style="text-transform:uppercase;">${object.company_id.name}</strong></h3> - </div> - <div style="width: 347px; margin: 0px; padding: 5px 14px; line-height: 16px; background-color: #F2F2F2;"> - <span style="color: #222; margin-bottom: 5px; display: block; "> - ${object.company_id.partner_id.sudo().with_context(show_address=True, html_format=True).name_get()[0][1] | safe} - </span> - % if object.company_id.phone: - <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "> - Phone: ${object.company_id.phone} - </div> - % endif - % if object.company_id.website: - <div> - Web : <a href="${object.company_id.website}">${object.company_id.website}</a> - </div> - % endif - <p></p> - </div> -</div> - ]]></field> - </record> - - </data> -</openerp> diff --git a/addons/purchase/data/mail_template_data.xml b/addons/purchase/data/mail_template_data.xml index 1a743871538..35188397f11 100644 --- a/addons/purchase/data/mail_template_data.xml +++ b/addons/purchase/data/mail_template_data.xml @@ -14,54 +14,27 @@ <field name="report_name">RFQ_${(object.name or '').replace('/','_')}</field> <field name="lang">${object.partner_id.lang}</field> <field name="body_html"><![CDATA[ -<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; "> +<p>Dear +% if object.partner_id.company_type == 'company' and object.child_ids: + ${object.partner_id.child_ids[0].name} +% else : + ${object.partner_id.name} +% endif +,</p><p> +Here is a ${object.state in ('draft', 'sent') and 'request for quotation' or 'purchase order confirmation'} <strong>${object.name}</strong> +% if object.partner_ref: + with reference: ${object.partner_ref} +% endif +% if object.origin: + (RFQ origin: ${object.origin}) +% endif +amounting <strong>${object.amount_total} ${object.currency_id.name}</strong> +from ${object.company_id.name}. +</p> - <p>Hello ${object.partner_id.name},</p> - - <p>Here is a ${object.state in ('draft', 'sent') and 'request for quotation' or 'purchase order confirmation'} from ${object.company_id.name}: </p> - - <p style="border-left: 1px solid #8e0000; margin-left: 30px;"> - <strong>REFERENCES</strong><br /> - RFQ number: <strong>${object.name}</strong><br /> - RFQ date: ${object.date_order}<br /> - % if object.origin: - RFQ reference: ${object.origin}<br /> - % endif - % if object.partner_ref: - Your reference: ${object.partner_ref}<br /> - % endif - % if object.create_uid: - Your contact: <a href="mailto:${object.create_uid.email or ''}?subject=Order%20${object.name}">${object.create_uid.name}</a> - % endif - </p> - - <br/> - <p>If you have any question, do not hesitate to contact us.</p> - <p>Thank you!</p> - <br/> - <br/> - <div style="width: 375px; margin: 0px; padding: 0px; background-color: #8E0000; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; background-repeat: repeat no-repeat;"> - <h3 style="margin: 0px; padding: 2px 14px; font-size: 12px; color: #DDD;"> - <strong style="text-transform:uppercase;">${object.company_id.name}</strong></h3> - </div> - <div style="width: 347px; margin: 0px; padding: 5px 14px; line-height: 16px; background-color: #F2F2F2;"> - <span style="color: #222; margin-bottom: 5px; display: block; "> - ${object.company_id.partner_id.sudo().with_context(show_address=True, html_format=True).name_get()[0][1] | safe} - </span> - % if object.company_id.phone: - <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "> - Phone: ${object.company_id.phone} - </div> - % endif - % if object.company_id.website: - <div> - Web : <a href="${object.company_id.website}">${object.company_id.website}</a> - </div> - %endif - <p></p> - </div> -</div> - ]]></field> +<p>If you have any question, do not hesitate to contact us.</p> +<p>Best regards,</p> +]]></field> </record> @@ -77,55 +50,27 @@ <field name="report_name">PO_${(object.name or '').replace('/','_')}</field> <field name="lang">${object.partner_id.lang}</field> <field name="body_html"><![CDATA[ -<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; "> - - <p>Hello ${object.partner_id.name},</p> - - <p>Here is a ${object.state in ('draft', 'sent') and 'request for quotation' or 'purchase order confirmation'} from ${object.company_id.name}: </p> - - <p style="border-left: 1px solid #8e0000; margin-left: 30px;"> - <strong>REFERENCES</strong><br /> - Order number: <strong>${object.name}</strong><br /> - Order total: <strong>${object.amount_total} ${object.currency_id.name}</strong><br /> - Order date: ${object.date_order}<br /> - % if object.origin: - Order reference: ${object.origin}<br /> - % endif - % if object.partner_ref: - Your reference: ${object.partner_ref}<br /> - % endif - % if object.create_uid: - Your contact: <a href="mailto:${object.create_uid.email or ''}?subject=Order%20${object.name}">${object.create_uid.name}</a> - % endif - </p> +<p>Dear +% if object.partner_id.company_type == 'company' and object.child_ids: + ${object.partner_id.child_ids[0].name} +% else : + ${object.partner_id.name} +% endif +,</p><p> +Here is a ${object.state in ('draft', 'sent') and 'request for quotation' or 'purchase order confirmation'} <strong>${object.name}</strong> +% if object.partner_ref: + with reference: ${object.partner_ref} +% endif +% if object.origin: + (RFQ origin: ${object.origin}) +% endif +amounting <strong>${object.amount_total} ${object.currency_id.name}</strong> +from ${object.company_id.name}. +</p> - <br/> - <p>If you have any question, do not hesitate to contact us.</p> - <p>Thank you!</p> - <br/> - <br/> - <div style="width: 375px; margin: 0px; padding: 0px; background-color: #8E0000; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; background-repeat: repeat no-repeat;"> - <h3 style="margin: 0px; padding: 2px 14px; font-size: 12px; color: #DDD;"> - <strong style="text-transform:uppercase;">${object.company_id.name}</strong></h3> - </div> - <div style="width: 347px; margin: 0px; padding: 5px 14px; line-height: 16px; background-color: #F2F2F2;"> - <span style="color: #222; margin-bottom: 5px; display: block; "> - ${object.company_id.partner_id.sudo().with_context(show_address=True, html_format=True).name_get()[0][1] | safe} - </span> - % if object.company_id.phone: - <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "> - Phone: ${object.company_id.phone} - </div> - % endif - % if object.company_id.website: - <div> - Web : <a href="${object.company_id.website}">${object.company_id.website}</a> - </div> - %endif - <p></p> - </div> -</div> - ]]></field> +<p>If you have any question, do not hesitate to contact us.</p> +<p>Best regards,</p> +]]></field> </record> </data> diff --git a/addons/sale/data/mail_template_data.xml b/addons/sale/data/mail_template_data.xml index ee245b26aac..fa069f0fc1e 100644 --- a/addons/sale/data/mail_template_data.xml +++ b/addons/sale/data/mail_template_data.xml @@ -14,63 +14,34 @@ <field name="report_name">${(object.name or '').replace('/','_')}_${object.state == 'draft' and 'draft' or ''}</field> <field name="lang">${object.partner_id.lang}</field> <field name="body_html"><![CDATA[ -<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; "> +% set access_action = object.get_access_action() +% set doc_name = 'quotation' if object.state in ('draft', 'sent') else 'order confirmation' +% set is_online = access_action and access_action['type'] == 'ir.actions.act_url' +% set access_name = is_online and object.template_id and 'Accept and pay %s online' % doc_name or 'View %s' % doc_name +% set access_url = is_online and access_action['url'] or '/report/pdf/sale.report_saleorder/' + str(object.id) - <p>Hello ${object.partner_id.name},</p> - - <p>Here is your ${object.state in ('draft', 'sent') and 'quotation' or 'order confirmation'} from ${object.company_id.name}: </p> +<p>Dear +% if object.partner_id.company_type == 'company' and object.child_ids: + ${object.partner_id.child_ids[0].name} +% else : + ${object.partner_id.name} +% endif +,</p> +<p>Thank you for your inquiry.<br /> +Here is your ${doc_name} <strong>${object.name}</strong> +% if object.origin: +(with reference: ${object.origin} ) +% endif +amounting <strong>${object.amount_total} ${object.pricelist_id.currency_id.name}</strong> +from ${object.company_id.name}. +</p> - <p style="border-left: 1px solid #8e0000; margin-left: 30px;"> - <strong>REFERENCES</strong><br /> - Order number: <strong>${object.name}</strong><br /> - Order total: <strong>${object.amount_total} ${object.pricelist_id.currency_id.name}</strong><br /> - Order date: ${format_tz(object.date_order, tz=user.tz, context={'lang':object.partner_id.lang})} <br /> - % if object.origin: - Order reference: ${object.origin}<br /> - % endif - % if object.client_order_ref: - Your reference: ${object.client_order_ref}<br /> - % endif - % if object.user_id: - Your contact: <a href="mailto:${object.user_id.email or ''}?subject=Order%20${object.name}">${object.user_id.name}</a> - % endif - </p> - - % if object.paypal_url: - <br/> - <p>It is also possible to directly pay with Paypal:</p> - <a style="margin-left: 120px;" href="${object.paypal_url}"> - <img class="oe_edi_paypal_button" src="/sale/static/img/btn_paynowcc_lg.gif"/> - </a> - % endif - - <br/> - <p>If you have any question, do not hesitate to contact us.</p> - <p>Thank you for choosing ${object.company_id.name or 'us'}!</p> - <br/> - <br/> - <div style="width: 375px; margin: 0px; padding: 0px; background-color: #8E0000; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; background-repeat: repeat no-repeat;"> - <h3 style="margin: 0px; padding: 2px 14px; font-size: 12px; color: #DDD;"> - <strong style="text-transform:uppercase;">${object.company_id.name}</strong></h3> - </div> - <div style="width: 347px; margin: 0px; padding: 5px 14px; line-height: 16px; background-color: #F2F2F2;"> - <span style="color: #222; margin-bottom: 5px; display: block; "> - ${object.company_id.partner_id.sudo().with_context(show_address=True, html_format=True).name_get()[0][1] | safe} - </span> - % if object.company_id.phone: - <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "> - Phone: ${object.company_id.phone} - </div> - % endif - % if object.company_id.website: - <div> - Web : <a href="${object.company_id.website}">${object.company_id.website}</a> - </div> - %endif - <p></p> - </div> -</div> - ]]></field> +<p style="margin-left: 30px; margin-top: 10 px; margin-bottom: 10px;"> + <a href="${access_url}" style="padding: 5px 10px; font-size: 12px; line-height: 18px; color: #FFFFFF; border-color:#a24689; text-decoration: none; display: inline-block; margin-bottom: 0px; font-weight: 400; text-align: center; vertical-align: middle; cursor: pointer; white-space: nowrap; background-image: none; background-color: #a24689; border: 1px solid #a24689; border-radius:3px" class="o_default_snippet_text">${access_name}</a> +</p> +<p>If you have any question, do not hesitate to contact us.</p> +<p>Best regards,</p> +]]></field> </record> </data> diff --git a/addons/website_quote/data/website_quotation_data.xml b/addons/website_quote/data/website_quotation_data.xml index bb01e321a32..042cc39f3f0 100644 --- a/addons/website_quote/data/website_quotation_data.xml +++ b/addons/website_quote/data/website_quotation_data.xml @@ -19,71 +19,6 @@ <!-- Mails & quote templates is done in a NOUPDATE block so users can freely customize/delete them --> <data noupdate="1"> - <record id="sale.email_template_edi_sale" model="mail.template"> - <field name="body_html"><![CDATA[ -<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; "> - - <p>Hello ${object.partner_id.name},</p> - - <p>Here is your ${object.state in ('draft', 'sent') and 'quotation' or 'order confirmation'} from ${object.company_id.name}: </p> - - <p style="border-left: 1px solid #8e0000; margin-left: 30px;"> - <strong>REFERENCES</strong><br /> - Order number: <strong>${object.name}</strong><br /> - Order total: <strong>${object.amount_total} ${object.pricelist_id.currency_id.name}</strong><br /> - Order date: ${object.date_order}<br /> - % if object.origin: - Order reference: ${object.origin}<br /> - % endif - % if object.client_order_ref: - Your reference: ${object.client_order_ref}<br /> - % endif - % if object.user_id: - Your contact: <a href="mailto:${object.user_id.email or ''}?subject=Order%20${object.name}">${object.user_id.name}</a> - % endif - </p> - <p> - You can view your quotation online: - </p> - <a style="display:block; width: 150px; height:20px; margin-left: 120px; color: #DDD; font-family: 'Lucida Grande', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: bold; text-align: center; text-decoration: none !important; line-height: 1; padding: 5px 0px 0px 0px; background-color: #8E0000; border-radius: 5px 5px; background-repeat: repeat no-repeat;" - href="/quote/${object.id}/${object.access_token}">View ${object.state in ('draft', 'sent') and 'Quotation' or 'Order'}</a> - - % if object.paypal_url: - <br/> - <p>It is also possible to directly pay with Paypal:</p> - <a style="margin-left: 120px;" href="${object.paypal_url}"> - <img class="oe_edi_paypal_button" src="/sale/static/img/btn_paynowcc_lg.gif"/> - </a> - % endif - - <br/> - <p>If you have any question, do not hesitate to contact us.</p> - <p>Thank you for choosing ${object.company_id.name or 'us'}!</p> - <br/> - <br/> - <div style="width: 375px; margin: 0px; padding: 0px; background-color: #8E0000; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; background-repeat: repeat no-repeat;"> - <h3 style="margin: 0px; padding: 2px 14px; font-size: 12px; color: #DDD;"> - <strong style="text-transform:uppercase;">${object.company_id.name}</strong></h3> - </div> - <div style="width: 347px; margin: 0px; padding: 5px 14px; line-height: 16px; background-color: #F2F2F2;"> - <span style="color: #222; margin-bottom: 5px; display: block; "> - ${object.company_id.partner_id.sudo().with_context(show_address=True, html_format=True).name_get()[0][1] | safe} - </span> - % if object.company_id.phone: - <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "> - Phone: ${object.company_id.phone} - </div> - % endif - % if object.company_id.website: - <div> - Web : <a href="${object.company_id.website}">${object.company_id.website}</a> - </div> - %endif - <p></p> - </div> -</div> - ]]></field> - </record> <record id="website_quote_template_default" model="sale.quote.template"> <field name="name">Default Template</field> @@ -155,85 +90,5 @@ </field> </record> - <!--Email template --> - <record id="email_template_edi_sale" model="mail.template"> - <field name="name">Sales Order - Send by Email (Online Quote)</field> - <field name="email_from">${(object.user_id.email or '')|safe}</field> - <field name="subject">${object.company_id.name|safe} ${object.state in ('draft', 'sent') and 'Quotation' or 'Order'} (Ref ${object.name or 'n/a' })</field> - <field name="partner_to">${object.partner_invoice_id.id}</field> - <field name="model_id" ref="sale.model_sale_order"/> - <field name="auto_delete" eval="True"/> - <field name="report_template" ref="sale.report_sale_order"/> - <field name="report_name">${(object.name or '').replace('/','_')}_${object.state == 'draft' and 'draft' or ''}</field> - <field name="lang">${object.partner_id.lang}</field> - <field name="user_signature" eval="True"/> - <field name="body_html"><![CDATA[ -<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: rgb(255, 255, 255); "> - - <p>Hello ${object.partner_id.name},</p> - - <p>Here is your ${object.state in ('draft', 'sent') and 'quotation' or 'order confirmation'} from ${object.company_id.name}: </p> - - <p style="border-left: 1px solid #8e0000; margin-left: 30px;"> - <strong>REFERENCES</strong><br /> - Order number: <strong>${object.name}</strong><br /> - Order total: <strong>${object.amount_total} ${object.pricelist_id.currency_id.name}</strong><br /> - Order date: ${object.date_order}<br /> - % if object.origin: - Order reference: ${object.origin}<br /> - % endif - % if object.client_order_ref: - Your reference: ${object.client_order_ref}<br /> - % endif - % if object.user_id: - Your contact: <a href="mailto:${object.user_id.email or ''}?subject=Order%20${object.name}">${object.user_id.name}</a> - % endif - </p> - - <% set signup_url = object.get_signup_url() %> - % if signup_url and object.amount_total > 0 : - <p> - You can access this document and pay online via our Customer Portal: - </p> - <a style="display:block; width: 150px; height:20px; margin-left: 120px; color: #DDD; font-family: 'Lucida Grande', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: bold; text-align: center; text-decoration: none !important; line-height: 1; padding: 5px 0px 0px 0px; background-color: #8E0000; border-radius: 5px 5px; background-repeat: repeat no-repeat;" - href="${signup_url}">View ${object.state in ('draft', 'sent') and 'Quotation' or 'Order'}</a> - % endif - - % if object.paypal_url and object.amount_total > 0 : - <br/> - <p>It is also possible to directly pay with Paypal:</p> - <a style="margin-left: 120px;" href="${object.paypal_url}"> - <img class="oe_edi_paypal_button" src="/sale/static/img/btn_paynowcc_lg.gif"/> - </a> - % endif - - <br/> - <p>If you have any question, do not hesitate to contact us.</p> - <p>Thank you for choosing ${object.company_id.name or 'us'}!</p> - <br/> - <br/> - <div style="width: 375px; margin: 0px; padding: 0px; background-color: #8E0000; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; background-repeat: repeat no-repeat;"> - <h3 style="margin: 0px; padding: 2px 14px; font-size: 12px; color: #DDD;"> - <strong style="text-transform:uppercase;">${object.company_id.name}</strong></h3> - </div> - <div style="width: 347px; margin: 0px; padding: 5px 14px; line-height: 16px; background-color: #F2F2F2;"> - <span style="color: #222; margin-bottom: 5px; display: block; "> - ${object.company_id.partner_id.sudo().with_context(show_address=True, html_format=True).name_get()[0][1] | safe} - </span> - % if object.company_id.phone: - <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "> - Phone: ${object.company_id.phone} - </div> - % endif - % if object.company_id.website: - <div> - Web : <a href="${object.company_id.website}">${object.company_id.website}</a> - </div> - % endif - <p></p> - </div> -</div> - ]]></field> - </record> </data> </openerp> diff --git a/addons/website_quote/models/order.py b/addons/website_quote/models/order.py index 09392c0b913..904564c9bff 100644 --- a/addons/website_quote/models/order.py +++ b/addons/website_quote/models/order.py @@ -266,23 +266,6 @@ class sale_order(osv.osv): 'res_id': id, } - def action_quotation_send(self, cr, uid, ids, context=None): - action = super(sale_order, self).action_quotation_send(cr, uid, ids, context=context) - ir_model_data = self.pool.get('ir.model.data') - quote_template_id = self.read(cr, uid, ids, ['template_id'], context=context)[0]['template_id'] - if quote_template_id: - try: - template_id = ir_model_data.get_object_reference(cr, uid, 'website_quote', 'email_template_edi_sale')[1] - except ValueError: - pass - else: - action['context'].update({ - 'default_template_id': template_id, - 'default_use_template': True - }) - - return action - def _confirm_online_quote(self, cr, uid, order_id, tx, context=None): """ Payment callback: validate the order and write tx details in chatter """ order = self.browse(cr, uid, order_id, context=context) |
