4 <!-- EDI Export + Send email Action -->
5 <record id="ir_actions_server_edi_invoice" model="ir.actions.server">
6 <field name="code">if (object.type in ('out_invoice', 'out_refund')) and not object.partner_id.opt_out: object.edi_export_and_email(template_ext_id='account.email_template_edi_invoice', context=context)</field>
7 <field eval="6" name="sequence"/>
8 <field name="state">code</field>
9 <field name="type">ir.actions.server</field>
10 <field name="model_id" ref="account.model_account_invoice"/>
11 <field name="condition">True</field>
12 <field name="name">Auto-email confirmed invoices</field>
15 <!-- EDI related Email Templates menu -->
16 <record model="ir.actions.act_window" id="action_email_templates">
17 <field name="name">Email Templates</field>
18 <field name="res_model">email.template</field>
19 <field name="view_type">form</field>
20 <field name="view_mode">form,tree</field>
21 <field name="view_id" ref="email_template.email_template_tree" />
22 <field name="search_view_id" ref="email_template.view_email_template_search"/>
23 <field name="context">{'search_default_model_id':'account.invoice'}</field>
24 <field name="context" eval="{'search_default_model_id': ref('account.model_account_invoice')}"/>
26 <menuitem id="menu_email_templates" parent="menu_configuration_misc" action="action_email_templates" sequence="30" groups="base.group_no_one"/>
30 <!-- Mail template and workflow bindings are done in a NOUPDATE block
31 so users can freely customize/delete them -->
33 <!-- bind the mailing server action to invoice open activity -->
34 <record id="account.act_open" model="workflow.activity">
35 <field name="action_id" ref="ir_actions_server_edi_invoice"/>
38 <!--Email template -->
39 <record id="email_template_edi_invoice" model="email.template">
40 <field name="name">Automated Invoice Notification Mail</field>
41 <field name="email_from">${object.user_id.email or object.company_id.email or 'noreply@localhost'}</field>
42 <field name="subject">${object.company_id.name} Invoice (Ref ${object.number or 'n/a' })</field>
43 <field name="email_to">${object.partner_id.email or ''}</field>
44 <field name="model_id" ref="account.model_account_invoice"/>
45 <field name="auto_delete" eval="True"/>
46 <field name="body_html"><![CDATA[
47 <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); ">
49 <p>Hello${object.partner_id.name and ' ' or ''}${object.partner_id.name or ''},</p>
51 <p>A new invoice is available for ${object.partner_id.name}: </p>
53 <p style="border-left: 1px solid #8e0000; margin-left: 30px;">
54 <strong>REFERENCES</strong><br />
55 Invoice number: <strong>${object.number}</strong><br />
56 Invoice total: <strong>${object.amount_total} ${object.currency_id.name}</strong><br />
57 Invoice date: ${object.date_invoice}<br />
59 Order reference: ${object.origin}<br />
61 Your contact: <a href="mailto:${object.user_id.email or ''}?subject=Invoice%20${object.number}">${object.user_id.name}</a>
65 You can view the invoice document, download it and pay online using the following link:
67 <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;"
68 href="${ctx.get('edi_web_url_view') or ''}">View Invoice</a>
70 % if object.company_id.paypal_account and object.type in ('out_invoice', 'in_refund'):
72 comp_name = quote(object.company_id.name)
73 inv_number = quote(object.number)
74 paypal_account = quote(object.company_id.paypal_account)
75 inv_amount = quote(str(object.amount_total))
76 cur_name = quote(object.currency_id.name)
77 paypal_url = "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=%s&item_name=%s%%20Invoice%%20%s&" \
78 "invoice=%s&amount=%s&currency_code=%s&button_subtype=services&no_note=1&bn=OpenERP_Invoice_PayNow_%s" % \
79 (paypal_account,comp_name,inv_number,inv_number,inv_amount,cur_name,cur_name)
82 <p>It is also possible to directly pay with Paypal:</p>
83 <a style="margin-left: 120px;" href="${paypal_url}">
84 <img class="oe_edi_paypal_button" src="https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif"/>
89 <p>If you have any question, do not hesitate to contact us.</p>
90 <p>Thank you for choosing ${object.company_id.name or 'us'}!</p>
93 <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;">
94 <h3 style="margin: 0px; padding: 2px 14px; font-size: 12px; color: #FFF;">
95 <strong style="text-transform:uppercase;">${object.company_id.name}</strong></h3>
97 <div style="width: 347px; margin: 0px; padding: 5px 14px; line-height: 16px; background-color: #F2F2F2;">
98 <span style="color: #222; margin-bottom: 5px; display: block; ">
99 % if object.company_id.street:
100 ${object.company_id.street}<br/>
102 % if object.company_id.street2:
103 ${object.company_id.street2}<br/>
105 % if object.company_id.city or object.company_id.zip:
106 ${object.company_id.zip} ${object.company_id.city}<br/>
108 % if object.company_id.country_id:
109 ${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>
112 % if object.company_id.phone:
113 <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; ">
114 Phone: ${object.company_id.phone}
117 % if object.company_id.website:
119 Web : <a href="${object.company_id.website}">${object.company_id.website}</a>
126 <field name="body_text"><![CDATA[
127 Hello${object.partner_id.name and ' ' or ''}${object.partner_id.name or ''},
129 A new invoice is available for ${object.partner_id.name}:
130 | Invoice number: *${object.number}*
131 | Invoice total: *${object.amount_total} ${object.currency_id.name}*
132 | Invoice date: ${object.date_invoice}
134 | Order reference: ${object.origin}
136 | Your contact: ${object.user_id.name} ${object.user_id.email and '<%s>'%(object.user_id.email) or ''}
138 You can view the invoice document, download it and pay online using the following link:
139 ${ctx.get('edi_web_url_view') or 'n/a'}
141 % if object.company_id.paypal_account and object.type in ('out_invoice', 'in_refund'):
143 comp_name = quote(object.company_id.name)
144 inv_number = quote(object.number)
145 paypal_account = quote(object.company_id.paypal_account)
146 inv_amount = quote(str(object.amount_total))
147 cur_name = quote(object.currency_id.name)
148 paypal_url = "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=%s&item_name=%s%%20Invoice%%20%s"\
149 "&invoice=%s&amount=%s¤cy_code=%s&button_subtype=services&no_note=1&bn=OpenERP_Invoice_PayNow_%s" % \
150 (paypal_account,comp_name,inv_number,inv_number,inv_amount,cur_name,cur_name)
152 It is also possible to directly pay with Paypal:
156 If you have any question, do not hesitate to contact us.
159 Thank you for choosing ${object.company_id.name}!
163 ${object.user_id.name} ${object.user_id.email and '<%s>'%(object.user_id.email) or ''}
164 ${object.company_id.name}
165 % if object.company_id.street:
166 ${object.company_id.street or ''}
168 % if object.company_id.street2:
169 ${object.company_id.street2}
171 % if object.company_id.city or object.company_id.zip:
172 ${object.company_id.zip or ''} ${object.company_id.city or ''}
174 % if object.company_id.country_id:
175 ${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}
177 % if object.company_id.phone:
178 Phone: ${object.company_id.phone}
180 % if object.company_id.website:
181 ${object.company_id.website or ''}