[IMP] currencies in mails + minor

bzr revid: jco@openerp.com-20121206164006-tx2paj5ybek6aupa
This commit is contained in:
Josse Colpaert 2012-12-06 17:40:06 +01:00
parent f67c93855a
commit bd2d663b22
8 changed files with 36 additions and 59 deletions

View File

@ -75,7 +75,7 @@ class followup_line(osv.osv):
Exception made if there was a mistake of ours, it seems that the following amount stays unpaid. Please, take appropriate measures in order to carry out this payment in the next 8 days.
Would your payment have been carried out after this mail was sent, please ignore this message. Do not hesitate to contact our accounting department at (+32).10.68.94.39.
Would your payment have been carried out after this mail was sent, please ignore this message. Do not hesitate to contact our accounting department.
Best Regards,
""",
@ -180,10 +180,7 @@ class res_partner(osv.osv):
root.insert(0, first_node[0])
res['arch'] = etree.tostring(doc, encoding="utf-8")
return res
# def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False, access_rights_uid=None):
# if order and order[0] == '':
# pass
def _get_latest(self, cr, uid, ids, names, arg, context=None, company_id=None):
res={}
@ -328,10 +325,6 @@ class res_partner(osv.osv):
'payment_earliest_due_date': calc_date}
return res
def _search_unreconciled(self, cr, uid, obj, name, args, field, context=None):
pass
def _payment_overdue_search(self, cr, uid, obj, name, args, context=None):
company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
if not args:
@ -343,8 +336,7 @@ class res_partner(osv.osv):
query = self.pool.get('account.move.line')._query_get(cr, uid, context=context)
cr.execute(('SELECT pid AS partner_id, SUM(bal2) FROM ' \
'(SELECT CASE WHEN bal IS NOT NULL THEN bal ' \
'ELSE 0.0 END AS bal2, p.id as pid ' \
' FROM ' \
'ELSE 0.0 END AS bal2, p.id as pid FROM ' \
'(SELECT (debit-credit) AS bal, partner_id ' \
'FROM account_move_line l ' \
'WHERE account_id IN ' \
@ -417,19 +409,18 @@ class res_partner(osv.osv):
_inherit = "res.partner"
_columns = {
'payment_responsible_id':fields.many2one('res.users', ondelete='set null', string='Follow-up Responsible',
help="Responsible for making sure the action happens. "),
help="Optionally you can assign a user to this field, which will make him responsible for the action. "),
'payment_note':fields.text('Customer Payment Promise', help="Payment Note"),
'payment_next_action':fields.text('Next Action',
help="This is the next action to be taken. It will automatically be set when the partner gets a follow-up level that requires a manual action. "),
'payment_next_action_date':fields.date('Next Action Date',
help="This is when the manual follow-up is needed. " \
"The date will be set to the current date when the partner gets a follow-up level that requires a manual action. Can be practical to set manually e.g. to follow up his payment. "),
"The date will be set to the current date when the partner gets a follow-up level that requires a manual action. Can be practical to set manually e.g. to see if he keeps his promises. "),
'unreconciled_aml_ids':fields.one2many('account.move.line', 'partner_id', domain=['&', ('reconcile_id', '=', False), '&',
('account_id.active','=', True), '&', ('account_id.type', '=', 'receivable'), ('state', '!=', 'draft')]),
'latest_followup_date':fields.function(_get_latest, method=True, type='date', string="Latest Follow-up Date",
help="Latest date that the follow-up level of the partner was changed",
store=False,
multi="latest"),
store=False, multi="latest"),
'latest_followup_level_id':fields.function(_get_latest, method=True,
type='many2one', relation='account_followup.followup.line', string="Latest Follow-up Level",
help="The maximum follow-up level",

View File

@ -33,7 +33,6 @@
<filter string="Partners with Overdue Credits" domain="[('payment_amount_overdue', '>', 0.0)]" name="credits"/>
<separator/>
<filter string="Follow-ups To Do" domain="[('payment_next_action_date', '&lt;=', time.strftime('%%Y-%%m-%%d')), ('credit', '>', 0.0)]" name="todo"/>
<filter string="Future Follow-ups" domain="[('payment_next_action_date', '&gt;', time.strftime('%%Y-%%m-%%d')), ('credit', '>', 0.0)]"/>
<separator/>
<filter string="No Responsible" domain="[('payment_responsible_id', '=', False)]"/>
<filter string="My Follow-ups" domain="[('payment_responsible_id','=', uid)]"/>

View File

@ -26,20 +26,15 @@ contact our accounting department.
</p>
<br/>
Best Regards,
<br/>
<br/>
${user.name | h}
<br/>
<br/>
<%
from openerp.addons.account_followup.report import account_followup_print
rml_parse = account_followup_print.report_rappel(object._cr, user.id, "followup_rml_parser")
followup_table = rml_parse.get_unreconciled_table(object, user.company_id, ctx)
%>
${followup_table | h}
${ctx['followup_table']}
<br/>
@ -74,19 +69,14 @@ Details of due payments is printed below.
<br/>
Best Regards,
<br/>
<br/>
${user.name | h}
<br/>
<br/>
<%
from openerp.addons.account_followup.report import account_followup_print
rml_parse = account_followup_print.report_rappel(object._cr, user.id, "followup_rml_parser")
followup_table = rml_parse.get_unreconciled_table(object, user.company_id, ctx)
%>
${followup_table | h}
${ctx['followup_table']}
<br/>
@ -116,18 +106,13 @@ In case of any queries concerning this matter, do not hesitate to contact our ac
<br/>
Best Regards,
<br/>
<br/>
${user.name | h}
<br/>
<br/>
<%
from openerp.addons.account_followup.report import account_followup_print
rml_parse = account_followup_print.report_rappel(object._cr, user.id, "followup_rml_parser")
followup_table = rml_parse.get_unreconciled_table(object, user.company_id, ctx)
%>
${object.followup_table(object, user) | h}
${ctx['followup_table']}
<br/>
@ -157,20 +142,13 @@ contact our accounting department.
</p>
<br/>
Best Regards,
</br>
</br>
<br/>
<br/>
${user.name | h}
<br/>
<br/>
<%
from openerp.addons.account_followup.report import account_followup_print
rml_parse = account_followup_print.report_rappel(object._cr, user.id, "followup_rml_parser")
followup_table = rml_parse.get_unreconciled_table(object, user.company_id, ctx)
%>
${followup_table | h}
${ctx['followup_table']}
<br/>
</div>

View File

@ -17,7 +17,7 @@ Unless full payment is made in next 8 days, then legal action for the recovery o
I trust that this action will prove unnecessary and details of due payments is printed below.
In case of any queries concerning this matter, do not hesitate to contact our accounting department at [TEL NUMBER].
In case of any queries concerning this matter, do not hesitate to contact our accounting department.
Best Regards,
</field>
@ -39,7 +39,7 @@ Unless full payment is made in next 8 days, then legal action for the recovery o
I trust that this action will prove unnecessary and details of due payments is printed below.
In case of any queries concerning this matter, do not hesitate to contact our accounting department at [TEL NUMBER].
In case of any queries concerning this matter, do not hesitate to contact our accounting department.
Best Regards,
</field>

View File

@ -76,9 +76,11 @@
To remind customers of paying their invoices, you can
define different actions depending on how severely
overdue the customer is. These actions are bundled
into folow-up levels that are triggered when the due
date of the most overdue invoice has passed a certain
number of days.
into follow-up levels that are triggered when the due
date of an invoice has passed a certain
number of days. If there are other overdue invoices for the
same customer, the actions of the most
overdue invoice will be executed.
</p>
<field name="followup_line"/>
</form>
@ -167,7 +169,7 @@
</tree>
</field>
</record>
<!--
<record id="view_move_line_form" model="ir.ui.view">
<field name="name">account.move.line.form.followup</field>
<field name="model">account.move.line</field>
@ -178,6 +180,6 @@
<field name="followup_date"/>
</field>
</field>
</record>-->
</record>
</data>
</openerp>

View File

@ -85,7 +85,7 @@ class report_rappel(report_sxw.rml_parse):
final_res = self._lines_get_with_partner(partner, company.id)
followup_table = ''
for currency_dict in final_res:
currency_symbol = currency_dict.get('line', [{'currency_id': company.currency_id}])[0]['currency_id'].symbol
currency = currency_dict.get('line', [{'currency_id': company.currency_id}])[0]['currency_id']
followup_table += '''
<table border="2" width=100%%>
<tr>
@ -95,7 +95,7 @@ class report_rappel(report_sxw.rml_parse):
<td>Amount (%s)</td>
<td>Lit.</td>
</tr>
''' % (currency_symbol)
''' % (currency.symbol)
total = 0
ctx = context
for aml in currency_dict['line']:
@ -107,8 +107,10 @@ class report_rappel(report_sxw.rml_parse):
if date <= ctx['current_date'] and aml['balance'] > 0:
strbegin = "<TD><B>"
strend = "</B></TD>"
followup_table +="<TR>" + strbegin + str(aml['date']) + strend + strbegin + aml['ref'] + strend + strbegin + str(date) + strend + strbegin + str(aml['balance']) + strend + strbegin + block + strend + "</TR>"
total = self.formatLang(total, dp='Account', currency_obj=partner.company_id.currency_id)
followup_table +="<TR>" + strbegin + str(aml['date']) + strend + strbegin + \
aml['ref'] + strend + strbegin + str(date) + strend + strbegin + \
str(aml['balance']) + strend + strbegin + block + strend + "</TR>"
total = self.formatLang(total, dp='Account', currency_obj=currency)
followup_table += '''<tr> </tr>
</table>
<center>Amount due: %s </center>''' % (total)

View File

@ -198,7 +198,12 @@ class account_followup_print(osv.osv_memory):
ids = self.pool.get('res.partner').search(cr, uid, ['&', ('credit', '<=', 0.0), '&', ('id', 'not in', partner_list_ids), '|',
('payment_responsible_id', '!=', False),
('payment_next_action_date', '!=', False)], context=context)
self.pool.get('res.partner').action_done(cr, uid, ids, context=context)
parts = self.pool.get('res.partner').browse(cr, uid, ids, context=context)
newids = []
for part in parts:
if not part.unreconciled_aml_ids:
newids.append(part.id)
self.pool.get('res.partner').action_done(cr, uid, newids, context=context)
return len(ids)
def do_process(self, cr, uid, ids, context=None):

View File

@ -13,7 +13,7 @@
</group>
<p class ="oe_grey">
This action will send follow-up emails, print the letters and
set the manual actions per customers.
set the manual actions per customer, according to the follow-up levels defined.
</p>
<footer>
<button name="do_process" string="Send emails and generate letters" type="object" class="oe_highlight"/>