From c6080b4fe24df2183ac9dc6d88bf17009d5bfb46 Mon Sep 17 00:00:00 2001
From: Josse Colpaert
Date: Tue, 20 Nov 2012 16:29:59 +0100
Subject: [PATCH] [IMP] fix functional fields, security
bzr revid: jco@openerp.com-20121120152959-oz4in39d77ny65xl
---
addons/account_followup/account_followup.py | 33 +++++++++++--------
.../account_followup_customers.xml | 6 ++--
.../report/account_followup_report.xml | 2 +-
.../wizard/account_followup_print.py | 4 +--
.../wizard/account_followup_print_view.xml | 16 ++++-----
5 files changed, 33 insertions(+), 28 deletions(-)
diff --git a/addons/account_followup/account_followup.py b/addons/account_followup/account_followup.py
index 5af2207745a..1d30a7c4e53 100644
--- a/addons/account_followup/account_followup.py
+++ b/addons/account_followup/account_followup.py
@@ -203,29 +203,33 @@ class res_partner(osv.osv):
latest_date = False
latest_level = False
latest_level_without_lit = False
-
- for aml in amls:
+ latest_days = False
+ latest_days_without_lit = False
+ for aml in amls:
+ #Give initial value
if latest_date == False:
latest_date = aml.followup_date
- latest_level = aml.followup_line_id.id
- latest_days = aml.followup_line_id.delay
- if not aml.blocked:
- latest_level_without_lit = latest_level
+ if aml.followup_line_id:
+ latest_level = aml.followup_line_id.id
+ latest_days = aml.followup_line_id.delay
+ if not aml.blocked and latest_level_without_lit == False and aml.followup_line_id:
+ latest_level_without_lit = aml.followup_line_id.id
+ latest_days_without_lit = aml.followup_line_id.delay
+ #If initial value < ...
if latest_date and latest_level:
if aml.followup_date > latest_date:
latest_date = aml.followup_date
- if aml.followup_line_id.delay > latest_days:
+ if aml.followup_line_id and aml.followup_line_id.delay > latest_days:
latest_days = aml.followup_line_id.delay
latest_level = aml.followup_line_id.id
- if not aml.blocked:
- latest_level_without_lit = latest_level
- res[partner.id] = {'latest_followup_date': latest_date,
+ if not aml.blocked and latest_level_without_lit and aml.followup_line_id and aml.followup_line_id.delay > latest_days_without_lit:
+ latest_days_without_lit = aml.followup_line_id.delay
+ latest_level_without_lit = aml.followup_line_id.id
+ res[partner.id] = {'latest_followup_date': latest_date,
'latest_followup_level_id': latest_level,
'latest_followup_level_id_without_lit': latest_level_without_lit}
return res
-
-
-
+
#Problems company id? / Method necessary?
def _get_next_followup_level_id(self, cr, uid, ids, name, arg, context=None):
res = {}
@@ -323,7 +327,8 @@ class res_partner(osv.osv):
mtp = self.pool.get('email.template')
unknown_mails = 0
for partner in self.browse(cr, uid, partner_ids, context):
- if partner.email != '' and partner.email != ' ':
+ print "Email", partner.email
+ if partner.email != False and partner.email != '' and partner.email != ' ':
if partner.latest_followup_level_id_without_lit and partner.latest_followup_level_id_without_lit.send_email and partner.latest_followup_level_id_without_lit.email_template_id.id != False :
mtp.send_mail(cr, uid, partner.latest_followup_level_id_without_lit.email_template_id.id, partner.id, context=context)
else :
diff --git a/addons/account_followup/account_followup_customers.xml b/addons/account_followup/account_followup_customers.xml
index 4ea7df88b94..e3e60907271 100644
--- a/addons/account_followup/account_followup_customers.xml
+++ b/addons/account_followup/account_followup_customers.xml
@@ -134,13 +134,13 @@
- to be done by:
-
+ to be done by: No action defined right now.
+ attrs="{'invisible':['&',('payment_next_action_date','=', False), '&', ('payment_responsible_id','=', False), ('payment_next_action', '=', False)]}"
+ groups="res_security.group_partner_manager, account.group_account_user"/>
diff --git a/addons/account_followup/report/account_followup_report.xml b/addons/account_followup/report/account_followup_report.xml
index 84d84dcb2e7..611728c55d4 100644
--- a/addons/account_followup/report/account_followup_report.xml
+++ b/addons/account_followup/report/account_followup_report.xml
@@ -64,7 +64,7 @@
{'search_default_followup_level':1}
-
+
diff --git a/addons/account_followup/wizard/account_followup_print.py b/addons/account_followup/wizard/account_followup_print.py
index 9653c348df6..bed6f3496b6 100644
--- a/addons/account_followup/wizard/account_followup_print.py
+++ b/addons/account_followup/wizard/account_followup_print.py
@@ -167,7 +167,7 @@ class account_followup_print(osv.osv_memory):
if partner.max_followup_id.send_letter:
partner_ids_to_print.append(partner.id)
nbprints += 1
- partner_obj.message_post(cr, uid, [partner.partner_id.id], body=_("Follow-up letter will be sent"), context=context)
+ partner_obj.message_post(cr, uid, [partner.partner_id.id], body=_("Follow-up letter will be sent"), context=context)
resulttext = resulttext + str(nbmails) + " emails sent (" + str(nbunknownmails) + " with unknown email) \n " + str(nbprints) + " letters in report \n " + str(nbmanuals) + " total manual action(s) assigned: \n \n"
needprinting = False
if nbprints > 0:
@@ -178,7 +178,7 @@ class account_followup_print(osv.osv_memory):
action = partner_obj.do_partner_print(cr, uid, partner_ids_to_print, data, context)
result['needprinting'] = needprinting
result['resulttext'] = resulttext
- result['action'] = action or {}
+ result['action'] = action or {}
return result
def do_update_followup_level(self, cr, uid, to_update, partner_list, date, 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 468e2d954da..d816a16f98e 100644
--- a/addons/account_followup/wizard/account_followup_print_view.xml
+++ b/addons/account_followup/wizard/account_followup_print_view.xml
@@ -10,14 +10,13 @@
-
-
- This wizard will check the customers with overdue invoices and will execute the actions needed to
- send to the customer according to the Follow-up Levels defined. By clicking on the button, the emails will be sent
- a report will be generated for the letters. In the next screen you will see which actions were executed and be able to
- print the letters if there are any. Also the manual actions will be set when needed.
-
-
+
+ When you hit the button below, for every partner the most overdue invoice (without litigation) is checked.
+ If the amount of days overdue is greater or equal than the amount of days specified by a next follow-up level,
+ it will be updated to that next level and the actions of that level will be executed. (See Configuration > Follow-up Levels)
+