4 <!-- EDI Export + Send email Action -->
5 <record id="ir_actions_server_edi_invoice" model="ir.actions.server">
6 <field name="code"><![CDATA[
8 if not object.partner_id.opt_out:
9 web_root_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url', default="<WEB_ROOT_URL>")
11 # accessing the template will fail if it has been deleted - so we'll skip everything
12 tmpl = self.pool.get('ir.model.data').get_object(cr, uid, 'account', 'email_template_edi_invoice')
14 edi_token = self.pool.get('edi.document').export_edi(cr, uid, [object], context = context)[0]
15 context.update(edi_web_url_view='%s/web/view_edi?db=%s&token=%s' %(web_root_url, cr.dbname, edi_token))
16 self.pool.get('email.template').send_mail(cr, uid,tmpl.id,object.id,context=context)
20 <field eval="6" name="sequence"/>
21 <field name="state">code</field>
22 <field name="type">ir.actions.server</field>
23 <field name="model_id" ref="account.model_account_invoice"/>
24 <field name="condition">True</field>
25 <field name="name">Auto-email confirmed invoices</field>
29 <!-- Mail template and workflow bindings are done in a NOUPDATE block
30 so users can freely customize/delete them -->
32 <!-- bind the mailing server action to invoice open activity -->
33 <record id="account.act_open" model="workflow.activity">
34 <field name="action_id" ref="ir_actions_server_edi_invoice"/>
37 <!--Email template -->
38 <record id="email_template_edi_invoice" model="email.template">
39 <field name="name">Automated Invoice Notification Mail</field>
40 <field name="email_from">${object.user_id.user_email or object.company_id.email or 'noreply@localhost'}</field>
41 <field name="subject">${object.company_id.name} Invoice (Ref ${object.number or 'n/a' })</field>
42 <field name="email_to">${object.address_invoice_id.email or ''}</field>
43 <field name="model_id" ref="account.model_account_invoice"/>
44 <field name="body_html"><![CDATA[
45 <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); ">
47 <p>Hello${object.address_invoice_id.name and ' ' or ''}${object.address_invoice_id.name or ''},</p>
49 <p>A new invoice is available for ${object.partner_id.name}: </p>
51 <p style="border-left: 1px solid #8e0000; margin-left: 30px;">
52 <strong>REFERENCES</strong><br />
53 Invoice number: <strong>${object.number}</strong><br />
54 Invoice total: <strong>${object.amount_total} ${object.currency_id.name}</strong><br />
55 Invoice date: ${object.date_invoice}<br />
57 Order reference: ${object.origin}<br />
59 Your contact: <a href="mailto:${object.user_id.user_email or ''}?subject=Invoice%20${object.number}">${object.user_id.name}</a>
63 You can view the invoice document, download it and pay online using the following link:
65 <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-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(142, 0, 0); border-radius: 2px 2px; background-position: 0% 0%; background-repeat: repeat no-repeat;"
66 href="${ctx.get('edi_web_url_view') or ''}">View Invoice</a>
68 % if object.company_id.paypal_account:
70 <p>It is also possible to directly pay with Paypal:</p>
71 <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-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(142, 0, 0); border-radius: 2px 2px; background-position: 0% 0%; background-repeat: repeat no-repeat;"
72 href="${"https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=%s&item_name=OpenERP%%20Invoice%%20%s&invoice=%s&amount=%s&currency_code=%s&button_subtype=services&no_note=1&bn=OpenERP_Invoice_PayNow_%s"%(object.company_id.paypal_account,object.number and object.number.replace('/','%2f') or '', object.number and object.number.replace('/','%2f') or '', object.amount_total, object.currency_id.name, object.currency_id.name)}"
77 <p>If you have any question, do not hesitate to contact us.</p>
78 <p>Thank you for choosing ${object.company_id.name or 'us'}!</p>
81 <div style="width: 375px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; overflow-x: hidden; overflow-y: hidden; zoom: 1; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(142, 0, 0); border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 0px 0px; border-bottom-left-radius: 0px 0px; background-position: 0% 0%; background-repeat: repeat no-repeat; ">
82 <h3 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 9px; padding-right: 14px; padding-bottom: 9px; padding-left: 14px; font-size: 12px; font-weight: normal; font-style: normal; color: rgb(255, 255, 255); ">
83 <strong style="text-transform:uppercase;">${object.company_id.name}</strong></h3>
85 <div style="width: 347px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 12px; padding-right: 14px; padding-bottom: 12px; padding-left: 14px; overflow-x: hidden; overflow-y: hidden; zoom: 1; line-height: 16px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(242, 242, 242); ">
86 <span style="color: rgb(38, 72, 149); margin-bottom: 5px; display: block; ">
87 % if object.company_id.street:
88 ${object.company_id.street}<br/>
90 % if object.company_id.street2:
91 ${object.company_id.street2}<br/>
93 % if object.company_id.city or object.company_id.zip:
94 ${object.company_id.zip} ${object.company_id.city}<br/>
96 % if object.company_id.country_id:
97 ${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>
100 % if object.company_id.phone:
101 <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; ">
102 Phone: ${object.company_id.phone}
105 % if object.company_id.website:
107 Web : <a href="${object.company_id.website}">${object.company_id.website}</a>
114 <field name="body_text"><![CDATA[
115 Hello${object.address_invoice_id.name and ' ' or ''}${object.address_invoice_id.name or ''},
117 A new invoice is available for ${object.partner_id.name}:
118 | Invoice number: *${object.number}*
119 | Invoice total: *${object.amount_total} ${object.currency_id.name}*
120 | Invoice date: ${object.date_invoice}
122 | Order reference: ${object.origin}
124 | Your contact: ${object.user_id.name} ${object.user_id.user_email and '<%s>'%(object.user_id.user_email) or ''}
126 You can view the invoice document, download it and pay online using the following link:
127 ${ctx.get('edi_web_url_view') or 'n/a'}
129 % if object.company_id.paypal_account:
130 It is also possible to directly pay with Paypal:
131 ${"https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=%s&item_name=OpenERP%%20Invoice%%20%s&invoice=%s&amount=%s¤cy_code=%s&button_subtype=services&no_note=1&bn=OpenERP_Invoice_PayNow_%s"%(object.company_id.paypal_account, object.number and object.number.replace('/','%2f') or '', object.number and object.number.replace('/','%2f') or '', object.amount_total, object.currency_id.name, object.currency_id.name)}
134 If you have any question, do not hesitate to contact us.
137 Thank you for choosing ${object.company_id.name}!
141 ${object.user_id.name} ${object.user_id.user_email and '<%s>'%(object.user_id.user_email) or ''}
142 ${object.company_id.name}
143 % if object.company_id.street:
144 ${object.company_id.street or ''}
146 % if object.company_id.street2:
147 ${object.company_id.street2}
149 % if object.company_id.city or object.company_id.zip:
150 ${object.company_id.zip or ''} ${object.company_id.city or ''}
152 % if object.company_id.country_id:
153 ${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}
155 % if object.company_id.phone:
156 Phone: ${object.company_id.phone}
158 % if object.company_id.website:
159 ${object.company_id.website or ''}