[MERGE] account:

add new field paypal_account in res.company to contains the paypal username (usually email).
improve email template of account invoice
correct logic of opt-out. it was reversed implemented.

bzr revid: hmo@tinyerp.com-20110826110914-4x3ol3te9v416f6o
This commit is contained in:
Harry (OpenERP)
2011-08-26 16:39:14 +05:30
5 changed files with 41 additions and 14 deletions
+2 -1
View File
@@ -24,6 +24,7 @@ from osv import fields, osv
class res_company(osv.osv):
_inherit = "res.company"
_columns = {
'paypal_account': fields.char("Paypal Account", size=128, help="the paypal username (usually email)"),
'overdue_msg': fields.text('Overdue Payments Message', translate=True),
'property_reserve_and_surplus_account': fields.property(
'account.account',
@@ -44,4 +45,4 @@ class res_company(osv.osv):
res_company()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+1
View File
@@ -24,6 +24,7 @@
<field name="arch" type="xml">
<field name="currency_id" position="after">
<field name="property_reserve_and_surplus_account" colspan="2"/>
<field name="paypal_account" />
</field>
</field>
</record>
-2
View File
@@ -114,7 +114,6 @@ class account_invoice(osv.osv, ir_edi.edi):
return edi_doc_list
def edi_import(self, cr, uid, edi_document, context=None):
""" During import, invoices will import the company that is provided in the invoice as
a new partner (e.g. supplier company for a customer invoice will be come a supplier
record for the new invoice.
@@ -230,7 +229,6 @@ class account_invoice(osv.osv, ir_edi.edi):
if journal_id:
journal = account_journal_pool.browse(cr, uid, journal_id, context=context)
edi_document['journal_id'] = journal and self.edi_m2o(cr, uid, journal, context=context) or False
# for invoice lines, the account_id value should be taken from the product's default, i.e. from the default category, as it will not be provided.
for edi_invoice_line in edi_document.get('invoice_line', []):
product_id = edi_invoice_line.get('product_id', False)
+37 -11
View File
@@ -4,7 +4,7 @@
<!--Export edi document -->
<record id="ir_actions_server_edi_invoice" model="ir.actions.server">
<field name="code">context.update({'edi_web_url_view': '%s/edi/view_edi?db=%s&amp;token=%s' %(self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url'),cr.dbname, self.pool.get('ir.edi.document').export_edi(cr, uid, [object], context = context)[0])})
if object.partner_id.opt_out: self.pool.get('email.template').generate_mail(cr,
if not object.partner_id.opt_out: self.pool.get('email.template').generate_mail(cr,
uid,
self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'email_template_edi_invoice')[1],
[object.id],
@@ -26,25 +26,51 @@ if object.partner_id.opt_out: self.pool.get('email.template').generate_mail(cr,
<!--Email template -->
<record id="email_template_edi_invoice" model="email.template">
<field name="def_subject">${object.company_id.name} - Invoice ${object.number}</field>
<field name="def_to">${object.address_invoice_id.email}</field>
<field name="def_subject">${object.company_id.name} Invoice (Ref ${object.number or 'n/a' })</field>
<field name="def_to">${object.address_invoice_id.email or ''}</field>
<field name="object_name" ref="account.model_account_invoice"/>
<field name="use_sign">True</field>
<field name="def_body_text">Hello ${object.address_invoice_id.name},
<field name="def_body_html">
&lt;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); "&gt;
We just registered the invoice ${object.number} for ${object.amount_total} ${object.currency_id.name} for your company ${object.partner_id.name}.
You can click on the following link to preview, print and pay this invoice:
&lt;p&gt; Hello ${object.address_invoice_id.name and ' ' or ''},&lt;/p&gt;
&lt;p&gt; You can click on the following link to preview, print and pay invoice:
&lt;a href="${object._context.get('edi_web_url_view')}"&gt;${object._context.get('edi_web_url_view')}&lt;/a&gt;
&lt;/p&gt;
${object._context.get('edi_web_url_view')}
Please note that this invoice has to be paid before ${object.date_due or ''}
&lt;p style="border-left: 1px solid #8e0000; margin-left: 30px;"&gt; &lt;strong&gt;REFERENCES&lt;/strong&gt;&lt;br /&gt; Invoice number: &lt;strong&gt;${object.number}&lt;/strong&gt;&lt;br /&gt; Invoice amount: &lt;strong&gt;${object.amount_total} ${object.currency_id.name}&lt;/strong&gt;&lt;br /&gt; Invoice date: ${object.date_invoice or 'n/a'}&lt;br /&gt; Order reference: ${object.origin or 'n/a'}&lt;br /&gt; Your contact: &lt;a href="mailto:${object.user_id.user_email or ''}?subject=Invoice%20${object.number}"&gt;${object.user_id.name}&lt;/a&gt;&lt;/p&gt;
Regards,
${object.company_id.paypal_account and '&lt;p&gt;It is possible to pay with Paypal: &lt;br/&gt; &lt;a href=/"https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business='+object.company_id.paypal_account+'&amp;item_name=OpenERP%20Invoice%20'+object.number and object.number.replace('/','%2f') or ''+'&amp;invoice='+object.number and object.number.replace('/','%2f') or ''+'&amp;amount='+object.amount_total+'&amp;currency_code='+object.currency_id.name+'&amp;button_subtype=services&amp;no_note=1&amp;bn=OpenERP_Invoice_PayNow_'+object.currency_id.name+'/"&gt;&lt;img src=/"https://www.paypalobjects.com/en_US/i/btn/btn_paynowCC_LG.gif/" style=/"margin-left: 100px; border: 0px; padding: 1px; text-decoration: none;/"/&gt;&lt;/a&gt; &lt;/p&gt;'}
&lt;p&gt; If you have any question, do not hesitate to reply directly to this e-mail.&lt;/p&gt; &lt;p&gt; Thank you for choosing OpenERP!&lt;br /&gt; &lt;/p&gt; &lt;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-image: url(http://www.openerp.com/sites/default/files/red_gradient_bg.png); 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; "&gt; &lt;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); "&gt; &lt;strong&gt;${object.company_id.name}&lt;/strong&gt;&lt;/h3&gt; &lt;/div&gt; &lt;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); "&gt; &lt;div&gt; Contact:&lt;a href="mailto:${object.user_id.user_email or ''}?subject=Invoice%20${object.number}"&gt;${object.user_id.name}&lt;/a&gt;&lt;/div&gt; &lt;div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;p&gt; &lt;/p&gt;
</field>
<field name="def_body_text">
Hello ${object.address_invoice_id.name and ' ' or ''},
You can click on the following link to preview, print and pay invoice:
${object._context.get('edi_web_url_view')}
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} &lt;${object.user_id.user_email or ''}&gt;
${object.company_id.paypal_account and 'It is possible to pay with Paypal: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business='+object.company_id.paypal_account+'&amp;item_name=OpenERP%20Invoice%20'+object.number and object.number.replace('/','%2f') or ''+'&amp;invoice='+object.number and object.number.replace('/','%2f') or ''+'&amp;amount='+object.amount_total+'&amp;currency_code='+object.currency_id.name+'&amp;button_subtype=services&amp;no_note=1&amp;bn=OpenERP_Invoice_PayNow_'+object.currency_id.name}
If you have any question, do not hesitate to reply directly to this e-mail.
Thank you for choosing our service!
--
${object.company_id.name}
Contact: ${object.user_id.name} &lt;${object.user_id.user_email or ''}&gt;
</field>
<field name="template_language">mako</field>
<field name="name">Mail Template of Invoice For EDI Document</field>
<field name="model_int_name">account.invoice</field>
<field name="reply_to">${object.user_id.email or ''}</field>
<field name="reply_to">${object.user_id.user_email or ''}</field>
</record>
</data>
</openerp>
+1
View File
@@ -16,6 +16,7 @@
name: Junjun wala
supplier: False
company_id: res_company_test11
opt_out: True
-
I create one customer invoice
-