Adjusted email template

bzr revid: jco@openerp.com-20121029092901-gc8y4d1o04ijexkb
This commit is contained in:
Josse Colpaert 2012-10-29 10:29:01 +01:00
parent 81a802b22b
commit c74e937b0d
2 changed files with 18 additions and 90 deletions

View File

@ -197,7 +197,9 @@ class res_partner(osv.osv):
def do_partner_phonecall(self, cr, uid, partner_ids, context=None):
#partners = self.browse(cr, uid, partner_ids, context)
#print partner_ids
self.write(cr, uid, partner_ids, {'payment_next_date': fields.date.context_today(cr, uid, context), 'payment_next_action':'Phony'}, context)
print "Testing: " , fields.date.context_today(cr, uid, context)
self.write(cr, uid, partner_ids, {'payment_next_action_date': fields.date.context_today(cr, uid, context), 'payment_next_action' : 'Phoning'}, context)
@ -223,18 +225,18 @@ class res_partner(osv.osv):
mail_template_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account_followup', 'email_template_account_followup')
mtp = self.pool.get('email.template')
#mtp.subject = "Invoices overdue"
#user_obj = self.pool.get('res.users')
#mtp.email_from = user_obj.browse(cr, uid, uid, context=context)
for partner in self.browse(cr, uid, partner_ids, context):
pass
#Get max level of ids
# if partner.latest_followup_level_id.email_template_id != False:
# mtp.send_mail(cr, uid, partner.id, partner.latest_followup_level_id.email_template_id.id, context=context)
# else:
# mtp.send_mail(cr, uid, partner.id, mail_template_id.id, context=context)
if partner.latest_followup_level_id.email_template_id != False:
#print "From latest followup level", partner.latest_followup_level_id.email_template_id.id
mtp.send_mail(cr, uid, partner.latest_followup_level_id.email_template_id.id, partner.id, context=context)
else:
#print "From mail template", mail_template_id.id
mtp.send_mail(cr, uid, mail_template_id.id, partner.id, context=context)
#complete the mail body with partner information
#(to be discussed with fp) attach the report to the mail or include the move lines in the mail body
#send the mail (need to check the function name)

View File

@ -6,7 +6,7 @@
<!--Email template -->
<record id="email_template_account_followup" model="email.template">
<field name="name"></field>
<field name="name">Followup of outstanding accounts</field>
<field name="email_from">${object.user_id.email or ''}</field>
<field name="subject">${object.company_id.name} Followup</field>
<field name="email_to">${object.email}</field>
@ -16,94 +16,20 @@
<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); ">
${object.latest_followup_level_id.description}
<p>Hello${object.partner_id.name and ' ' or ''}${object.partner_id.name or ''},</p>
<p>Hello${object.name and ' ' or ''},</p>
<p>Here is your ${object.state in ('draft', 'sent') and 'quotation' or 'order confirmation'} from ${object.company_id.name}: </p>
<p>We see in our books that some accounts are not settled yet:</p>
<%for aml in ${object.accountmoveline_ids}>
${aml.debit}
<%endfor>
<p style="border-left: 1px solid #8e0000; margin-left: 30px;">
&nbsp;&nbsp;<strong>REFERENCES</strong><br />
&nbsp;&nbsp;Order number: <strong>${object.name}</strong><br />
&nbsp;&nbsp;Order total: <strong>${object.amount_total} ${object.pricelist_id.currency_id.name}</strong><br/>
&nbsp;&nbsp;Order date: ${object.date_order}<br/>
% if object.origin:
&nbsp;&nbsp;Order reference: ${object.origin}<br/>
% endif
% if object.client_order_ref:
&nbsp;&nbsp;Your reference: ${object.client_order_ref}<br />
% endif
&nbsp;&nbsp;Your contact: <a href="mailto:${object.user_id.email or ''}?subject=Order%20${object.name}">${object.user_id.name}</a>
</p>
<h1>
Testing
</h1>
<br/>
<p>
You can view the ${object.state in ('draft', 'sent') and 'quotation' or 'order confirmation'} document, download it and pay online using the following link:
</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-color: #8E0000; border-radius: 5px 5px; background-repeat: repeat no-repeat;"
href="${ctx.get('edi_web_url_view') or ''}">View Order</a>
% if object.order_policy in ('prepaid','manual') and object.company_id.paypal_account and object.state not in ('draft', 'sent'):
<%
comp_name = quote(object.company_id.name)
order_name = quote(object.name)
paypal_account = quote(object.company_id.paypal_account)
order_amount = quote(str(object.amount_total))
cur_name = quote(object.pricelist_id.currency_id.name)
paypal_url = "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=%s&amp;item_name=%s%%20Order%%20%s" \
"&amp;invoice=%s&amp;amount=%s&amp;currency_code=%s&amp;button_subtype=services&amp;no_note=1" \
"&amp;bn=OpenERP_Order_PayNow_%s" % \
(paypal_account,comp_name,order_name,order_name,order_amount,cur_name,cur_name)
%>
<br/>
<p>It is also possible to directly pay with Paypal:</p>
<a style="margin-left: 120px;" href="${paypal_url}">
<img class="oe_edi_paypal_button" src="https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif"/>
</a>
% endif
<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: 0px; padding: 0px; background-color: #8E0000; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; background-repeat: repeat no-repeat;">
<h3 style="margin: 0px; padding: 2px 14px; font-size: 12px; color: #FFF;">
<strong style="text-transform:uppercase;">${object.company_id.name}</strong></h3>
</div>
<div style="width: 347px; margin: 0px; padding: 5px 14px; line-height: 16px; background-color: #F2F2F2;">
<span style="color: #222; margin-bottom: 5px; display: block; ">
% if object.company_id.street:
${object.company_id.street}<br/>
% endif
% if object.company_id.street2:
${object.company_id.street2}<br/>
% endif
% if object.company_id.city or object.company_id.zip:
${object.company_id.zip} ${object.company_id.city}<br/>
% 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 ''}<br/>
% endif
</span>
% if object.company_id.phone:
<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; ">
Phone:&nbsp; ${object.company_id.phone}
</div>
% endif
% if object.company_id.website:
<div>
Web :&nbsp;<a href="${object.company_id.website}">${object.company_id.website}</a>
</div>
%endif
<p></p>
</div>
</div>
]]></field>
</record>