2011-06-30 13:37:57 +00:00
<?xml version="1.0" ?>
<openerp >
2011-09-30 21:21:54 +00:00
<data >
<!-- EDI Export + Send email Action -->
<record id= "ir_actions_server_edi_invoice" model= "ir.actions.server" >
2011-10-05 00:34:09 +00:00
<field name= "code" > < ![CDATA[
2011-09-30 21:21:54 +00:00
try:
if not object.partner_id.opt_out:
web_root_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url', default="<WEB_ROOT_URL > ")
2011-06-30 13:37:57 +00:00
2011-09-30 21:21:54 +00:00
# accessing the template will fail if it has been deleted - so we'll skip everything
2011-10-05 01:29:18 +00:00
tmpl = self.pool.get('ir.model.data').get_object(cr, uid, 'account', 'email_template_edi_invoice')
2011-07-15 07:44:42 +00:00
2011-10-05 01:29:18 +00:00
edi_token = self.pool.get('edi.document').export_edi(cr, uid, [object], context = context)[0]
2011-10-05 00:34:09 +00:00
context.update(edi_web_invoice_url_view='%s/web/view_edi?db=%s& token=%s' %(web_root_url, cr.dbname, edi_token))
2011-09-30 21:21:54 +00:00
self.pool.get('email.template').send_mail(cr, uid,tmpl.id,object.id,context=context)
except:
pass
2011-10-05 00:34:09 +00:00
]]></field>
2011-09-30 21:21:54 +00:00
<field eval= "6" name= "sequence" />
<field name= "state" > code</field>
<field name= "type" > ir.actions.server</field>
<field name= "model_id" ref= "account.model_account_invoice" />
<field name= "condition" > True</field>
<field name= "name" > EDI Document - Invoice</field>
</record>
</data>
2011-06-30 13:37:57 +00:00
2011-09-30 21:21:54 +00:00
<!-- Mail template and workflow bindings are done in a NOUPDATE block
so users can freely customize/delete them -->
<data noupdate= "1" >
<!-- bind the mailing server action to invoice open activity -->
<record id= "account.act_open" model= "workflow.activity" >
<field name= "action_id" ref= "ir_actions_server_edi_invoice" />
</record>
2011-06-30 13:37:57 +00:00
2011-09-30 21:21:54 +00:00
<!-- Email template -->
<record id= "email_template_edi_invoice" model= "email.template" >
<field name= "name" > Automated Invoice Notification Mail</field>
<field name= "email_from" > ${object.user_id.user_email or object.company_id.email or 'noreply@localhost'}</field>
<field name= "subject" > ${object.company_id.name} Invoice (Ref ${object.number or 'n/a' })</field>
<field name= "email_to" > ${object.address_invoice_id.email or ''}</field>
<field name= "model_id" ref= "account.model_account_invoice" />
2011-10-05 00:34:09 +00:00
<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); " >
2011-08-26 11:09:14 +00:00
2011-10-05 00:34:09 +00:00
<p > Hello${object.address_invoice_id.name and ' ' or ''}${object.address_invoice_id.name or ''},</p>
2011-09-30 21:21:54 +00:00
2011-10-05 00:34:09 +00:00
<p > A new invoice is available for ${object.partner_id.name}: </p>
2011-09-30 21:21:54 +00:00
2011-10-05 00:34:09 +00:00
<p style= "border-left: 1px solid #8e0000; margin-left: 30px;" >
<strong > REFERENCES</strong> <br />
Invoice number: <strong > ${object.number}</strong> <br />
Invoice amount: <strong > ${object.amount_total} ${object.currency_id.name}</strong> <br />
Invoice date: ${object.date_invoice or 'n/a'}<br />
Order reference: ${object.origin or 'n/a'}<br />
Your contact: <a href= "mailto:${object.user_id.user_email or ''}?subject=Invoice%20${object.number}" > ${object.user_id.name}</a>
</p>
2011-09-30 21:21:54 +00:00
2011-10-05 00:34:09 +00:00
<p >
2011-09-30 21:21:54 +00:00
You can view the invoice document, download it and pay online using the following link:
2011-10-05 00:34:09 +00:00
</p>
<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;"
href="${ctx.get('edi_web_invoice_url_view') or ''}">View Invoice</a>
2011-09-30 21:21:54 +00:00
% if object.company_id.paypal_account:
2011-10-05 00:34:09 +00:00
<br />
<p > It is also possible to directly pay with Paypal:</p>
<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;"
2011-09-30 21:21:54 +00:00
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)}"
2011-10-05 00:34:09 +00:00
>Pay with Paypal</a>
2011-09-30 21:21:54 +00:00
% endif
2011-10-05 00:34:09 +00:00
<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-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; " >
<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); " >
<strong style= "text-transform:uppercase;" > ${object.company_id.name}</strong> </h3>
</div>
<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); " >
<span style= "color: rgb(38, 72, 149); margin-bottom: 5px; display: block; " >
2011-09-30 21:21:54 +00:00
% if object.company_id.street:
2011-10-05 00:34:09 +00:00
${object.company_id.street}<br />
2011-09-30 21:21:54 +00:00
% endif
% if object.company_id.street2:
2011-10-05 00:34:09 +00:00
${object.company_id.street2}<br />
2011-09-30 21:21:54 +00:00
% endif
% if object.company_id.city or object.company_id.zip:
2011-10-05 00:34:09 +00:00
${object.company_id.zip} ${object.company_id.city}<br />
2011-09-30 21:21:54 +00:00
% endif
% if object.company_id.country_id:
2011-10-05 00:34:09 +00:00
${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br />
2011-09-30 21:21:54 +00:00
% endif
2011-10-05 00:34:09 +00:00
</span>
2011-09-30 21:21:54 +00:00
% if object.company_id.phone:
2011-10-05 00:34:09 +00:00
<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; " >
2011-09-30 21:21:54 +00:00
Phone: ${object.company_id.phone}
2011-10-05 00:34:09 +00:00
</div>
2011-09-30 21:21:54 +00:00
% endif
% if object.company_id.website:
2011-10-05 00:34:09 +00:00
<div >
Web : <a href= "${object.company_id.website}" > ${object.company_id.website}</a>
</div>
2011-09-30 21:21:54 +00:00
%endif
2011-10-05 00:34:09 +00:00
<p > </p>
</div>
</div>
]]></field>
<field name= "body_text" > < ![CDATA[
2011-09-30 21:21:54 +00:00
Hello${object.address_invoice_id.name and ' ' or ''}${object.address_invoice_id.name or ''},
2011-08-26 11:09:14 +00:00
2011-09-30 21:21:54 +00:00
A new invoice is available for ${object.partner_id.name}:
| Invoice Number: *${object.number}*
| Amount: *${object.amount_total} ${object.currency_id.name}*
| Invoice date: ${object.date_invoice or 'n/a'}
| Order reference: ${object.origin or 'n/a'}
| Your contact: ${object.user_id.name} ${object.user_id.user_email and '< %s> '%(object.user_id.user_email) or ''}
2011-08-26 11:09:14 +00:00
2011-09-30 21:21:54 +00:00
You can view the invoice document, download it and pay online using the following link:
${ctx.get('edi_web_invoice_url_view') or 'n/a'}
2011-08-26 11:09:14 +00:00
2011-09-30 21:21:54 +00:00
% if object.company_id.paypal_account:
It is also possible to directly pay with Paypal:
${"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)}
% endif
2011-06-30 13:37:57 +00:00
2011-09-30 21:21:54 +00:00
If you have any question, do not hesitate to contact us.
2011-07-15 07:44:42 +00:00
2011-06-30 13:37:57 +00:00
2011-09-30 21:21:54 +00:00
Thank you for choosing ${object.company_id.name}!
2011-06-30 13:37:57 +00:00
2011-09-30 21:21:54 +00:00
--
${object.user_id.name} ${object.user_id.user_email and '< %s> '%(object.user_id.user_email) or ''}
2011-08-26 11:09:14 +00:00
${object.company_id.name}
2011-09-30 21:21:54 +00:00
% if object.company_id.street:
${object.company_id.street or ''}
% endif
% if object.company_id.street2:
${object.company_id.street2}
% endif
% if object.company_id.city or object.company_id.zip:
${object.company_id.zip or ''} ${object.company_id.city or ''}
% endif
% if object.company_id.country_id:
${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}
% endif
% if object.company_id.phone:
Phone: ${object.company_id.phone}
% endif
% if object.company_id.website:
${object.company_id.website or ''}
% endif
2011-10-05 00:34:09 +00:00
]]></field>
2011-09-30 21:21:54 +00:00
</record>
</data>
2011-06-30 13:37:57 +00:00
</openerp>