From bd2d663b229221154c3d3b35486bd9f9703b443b Mon Sep 17 00:00:00 2001
From: Josse Colpaert
Date: Thu, 6 Dec 2012 17:40:06 +0100
Subject: [PATCH] [IMP] currencies in mails + minor
bzr revid: jco@openerp.com-20121206164006-tx2paj5ybek6aupa
---
addons/account_followup/account_followup.py | 21 +++-------
.../account_followup_customers.xml | 1 -
.../account_followup_data.xml | 38 ++++---------------
.../account_followup_demo.xml | 4 +-
.../account_followup_view.xml | 12 +++---
.../report/account_followup_print.py | 10 +++--
.../wizard/account_followup_print.py | 7 +++-
.../wizard/account_followup_print_view.xml | 2 +-
8 files changed, 36 insertions(+), 59 deletions(-)
diff --git a/addons/account_followup/account_followup.py b/addons/account_followup/account_followup.py
index 40ed2e1424e..3f89ac09502 100644
--- a/addons/account_followup/account_followup.py
+++ b/addons/account_followup/account_followup.py
@@ -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",
diff --git a/addons/account_followup/account_followup_customers.xml b/addons/account_followup/account_followup_customers.xml
index 8959143698e..54bd334a2df 100644
--- a/addons/account_followup/account_followup_customers.xml
+++ b/addons/account_followup/account_followup_customers.xml
@@ -33,7 +33,6 @@
-
diff --git a/addons/account_followup/account_followup_data.xml b/addons/account_followup/account_followup_data.xml
index af974a2b7e0..ffb5ae8d854 100644
--- a/addons/account_followup/account_followup_data.xml
+++ b/addons/account_followup/account_followup_data.xml
@@ -26,20 +26,15 @@ contact our accounting department.
Best Regards,
-
+
${user.name | h}
-<%
- 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']}
@@ -74,19 +69,14 @@ Details of due payments is printed below.
Best Regards,
+
${user.name | h}
-<%
- 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']}
@@ -116,18 +106,13 @@ In case of any queries concerning this matter, do not hesitate to contact our ac
Best Regards,
+
${user.name | h}
-<%
- 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']}
@@ -157,20 +142,13 @@ contact our accounting department.
Best Regards,
-
-
+
${user.name | h}
-<%
- 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']}
diff --git a/addons/account_followup/account_followup_demo.xml b/addons/account_followup/account_followup_demo.xml
index 053d611fc08..0c470f5980e 100644
--- a/addons/account_followup/account_followup_demo.xml
+++ b/addons/account_followup/account_followup_demo.xml
@@ -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,
@@ -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,
diff --git a/addons/account_followup/account_followup_view.xml b/addons/account_followup/account_followup_view.xml
index c1b79d20369..5560ca822dc 100644
--- a/addons/account_followup/account_followup_view.xml
+++ b/addons/account_followup/account_followup_view.xml
@@ -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.
@@ -167,7 +169,7 @@
-
+
diff --git a/addons/account_followup/report/account_followup_print.py b/addons/account_followup/report/account_followup_print.py
index 2b70f46142c..65a56957d07 100644
--- a/addons/account_followup/report/account_followup_print.py
+++ b/addons/account_followup/report/account_followup_print.py
@@ -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 += '''
@@ -95,7 +95,7 @@ class report_rappel(report_sxw.rml_parse):
Amount (%s) |
Lit. |
- ''' % (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 = ""
strend = " | "
- followup_table +="" + strbegin + str(aml['date']) + strend + strbegin + aml['ref'] + strend + strbegin + str(date) + strend + strbegin + str(aml['balance']) + strend + strbegin + block + strend + "
"
- total = self.formatLang(total, dp='Account', currency_obj=partner.company_id.currency_id)
+ followup_table +="" + strbegin + str(aml['date']) + strend + strbegin + \
+ aml['ref'] + strend + strbegin + str(date) + strend + strbegin + \
+ str(aml['balance']) + strend + strbegin + block + strend + "
"
+ total = self.formatLang(total, dp='Account', currency_obj=currency)
followup_table += '''
Amount due: %s ''' % (total)
diff --git a/addons/account_followup/wizard/account_followup_print.py b/addons/account_followup/wizard/account_followup_print.py
index 2c9b41a7859..5170a0f3b24 100644
--- a/addons/account_followup/wizard/account_followup_print.py
+++ b/addons/account_followup/wizard/account_followup_print.py
@@ -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):
diff --git a/addons/account_followup/wizard/account_followup_print_view.xml b/addons/account_followup/wizard/account_followup_print_view.xml
index 29f36522d05..62943330d63 100644
--- a/addons/account_followup/wizard/account_followup_print_view.xml
+++ b/addons/account_followup/wizard/account_followup_print_view.xml
@@ -13,7 +13,7 @@
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.