4 <!-- EDI Export + Send email Action -->
5 <record id="ir_actions_server_edi_sale" model="ir.actions.server">
6 <field name="code">if not object.partner_id.opt_out: object.edi_export_and_email(template_ext_id='sale.email_template_edi_sale', context=context)</field>
7 <field name="state">code</field>
8 <field name="type">ir.actions.server</field>
9 <field name="model_id" ref="sale.model_sale_order"/>
10 <field name="condition">True</field>
11 <field name="name">Auto-email confirmed sale orders</field>
14 <!-- EDI related Email Templates menu -->
15 <record model="ir.actions.act_window" id="action_email_templates">
16 <field name="name">Email Templates</field>
17 <field name="res_model">email.template</field>
18 <field name="view_type">form</field>
19 <field name="view_mode">form,tree</field>
20 <field name="view_id" ref="email_template.email_template_tree" />
21 <field name="search_view_id" ref="email_template.view_email_template_search"/>
22 <field name="context" eval="{'search_default_model_id': ref('sale.model_sale_order')}"/>
24 <menuitem id="base.menu_sales_configuration_misc" name="Miscellaneous" parent="base.menu_base_config" sequence="75"/>
28 <!-- Mail template and workflow bindings are done in a NOUPDATE block
29 so users can freely customize/delete them -->
31 <!-- bind the mailing server action to sale.order confirmed activity -->
32 <record id="sale.act_wait_ship" model="workflow.activity">
33 <field name="action_id" ref="ir_actions_server_edi_sale"/>
37 <!--Email template -->
38 <record id="email_template_edi_sale" model="email.template">
39 <field name="name">Automated Sale Order Notification Mail</field>
40 <field name="email_from">${object.user_id.user_email or ''}</field>
41 <field name="subject">${object.company_id.name} Order (Ref ${object.name or 'n/a' })</field>
42 <field name="email_to">${object.partner_invoice_id.email}</field>
43 <field name="model_id" ref="sale.model_sale_order"/>
44 <field name="auto_delete" eval="True"/>
45 <field name="body_html"><![CDATA[
46 <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); ">
48 <p>Hello${object.partner_order_id.name and ' ' or ''}${object.partner_order_id.name or ''},</p>
50 <p>Here is your order confirmation for ${object.partner_id.name}: </p>
52 <p style="border-left: 1px solid #8e0000; margin-left: 30px;">
53 <strong>REFERENCES</strong><br />
54 Order number: <strong>${object.name}</strong><br />
55 Order total: <strong>${object.amount_total} ${object.pricelist_id.currency_id.name}</strong><br />
56 Order date: ${object.date_order}<br />
58 Order reference: ${object.origin}<br />
60 % if object.client_order_ref:
61 Your reference: ${object.client_order_ref}<br />
63 Your contact: <a href="mailto:${object.user_id.user_email or ''}?subject=Order%20${object.name}">${object.user_id.name}</a>
67 You can view the order confirmation document, download it and pay online using the following link:
69 <a style="display:block; width: 150px; height:20px; margin-left: 120px; color: #FFF; 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;"
70 href="${ctx.get('edi_web_url_view') or ''}">View Order</a>
72 % if object.order_policy in ('prepaid','manual') and object.company_id.paypal_account:
74 comp_name = quote(object.company_id.name)
75 order_name = quote(object.name)
76 paypal_account = quote(object.company_id.paypal_account)
77 order_amount = quote(str(object.amount_total))
78 cur_name = quote(object.pricelist_id.currency_id.name)
79 paypal_url = "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=%s&item_name=%s%%20Order%%20%s" \
80 "&invoice=%s&amount=%s&currency_code=%s&button_subtype=services&no_note=1" \
81 "&bn=OpenERP_Order_PayNow_%s" % \
82 (paypal_account,comp_name,order_name,order_name,order_amount,cur_name,cur_name)
85 <p>It is also possible to directly pay with Paypal:</p>
86 <a style="margin-left: 120px;" href="${paypal_url}">
87 <img class="oe_edi_paypal_button" src="https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif"/>
92 <p>If you have any question, do not hesitate to contact us.</p>
93 <p>Thank you for choosing ${object.company_id.name or 'us'}!</p>
96 <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;">
97 <h3 style="margin: 0px; padding: 2px 14px; font-size: 12px; color: #FFF;">
98 <strong style="text-transform:uppercase;">${object.company_id.name}</strong></h3>
100 <div style="width: 347px; margin: 0px; padding: 5px 14px; line-height: 16px; background-color: #F2F2F2;">
101 <span style="color: #222; margin-bottom: 5px; display: block; ">
102 % if object.company_id.street:
103 ${object.company_id.street}<br/>
105 % if object.company_id.street2:
106 ${object.company_id.street2}<br/>
108 % if object.company_id.city or object.company_id.zip:
109 ${object.company_id.zip} ${object.company_id.city}<br/>
111 % if object.company_id.country_id:
112 ${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>
115 % if object.company_id.phone:
116 <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; ">
117 Phone: ${object.company_id.phone}
120 % if object.company_id.website:
122 Web : <a href="${object.company_id.website}">${object.company_id.website}</a>
129 <field name="body_text"><![CDATA[
130 Hello${object.partner_order_id.name and ' ' or ''}${object.partner_order_id.name or ''},
132 Here is your order confirmation for ${object.partner_id.name}:
133 | Order number: *${object.name}*
134 | Order total: *${object.amount_total} ${object.pricelist_id.currency_id.name}*
135 | Order date: ${object.date_order}
137 | Order reference: ${object.origin}
139 % if object.client_order_ref:
140 | Your reference: ${object.client_order_ref}<br />
142 | Your contact: ${object.user_id.name} ${object.user_id.user_email and '<%s>'%(object.user_id.user_email) or ''}
144 You can view the order confirmation, download it and even pay online using the following link:
145 ${ctx.get('edi_web_url_view') or 'n/a'}
147 % if object.order_policy in ('prepaid','manual') and object.company_id.paypal_account:
149 comp_name = quote(object.company_id.name)
150 order_name = quote(object.name)
151 paypal_account = quote(object.company_id.paypal_account)
152 order_amount = quote(str(object.amount_total))
153 cur_name = quote(object.pricelist_id.currency_id.name)
154 paypal_url = "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=%s&item_name=%s%%20Order%%20%s&invoice=%s&amount=%s" \
155 "¤cy_code=%s&button_subtype=services&no_note=1&bn=OpenERP_Order_PayNow_%s" % \
156 (paypal_account,comp_name,order_name,order_name,order_amount,cur_name,cur_name)
158 It is also possible to directly pay with Paypal:
162 If you have any question, do not hesitate to contact us.
165 Thank you for choosing ${object.company_id.name}!
169 ${object.user_id.name} ${object.user_id.user_email and '<%s>'%(object.user_id.user_email) or ''}
170 ${object.company_id.name}
171 % if object.company_id.street:
172 ${object.company_id.street or ''}
174 % if object.company_id.street2:
175 ${object.company_id.street2}
177 % if object.company_id.city or object.company_id.zip:
178 ${object.company_id.zip or ''} ${object.company_id.city or ''}
180 % if object.company_id.country_id:
181 ${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}
183 % if object.company_id.phone:
184 Phone: ${object.company_id.phone}
186 % if object.company_id.website:
187 ${object.company_id.website or ''}