From 5f6255c970e721caa08f74a8eab78a62d0e53745 Mon Sep 17 00:00:00 2001
From: Josse Colpaert
Date: Fri, 16 Nov 2012 17:14:37 +0100
Subject: [PATCH] [IMP] kanban view, greys, first tab context
bzr revid: jco@openerp.com-20121116161437-pdjig82ybpxda184
---
addons/account_followup/account_followup.py | 49 +++++-
.../account_followup_customers.xml | 152 ++++++------------
.../account_followup_data.xml | 2 -
.../account_followup_demo.xml | 66 +++++++-
.../account_followup_view.xml | 65 +++++---
.../report/account_followup_report.xml | 4 +-
.../wizard/account_followup_print.py | 28 +---
.../wizard/account_followup_print_view.xml | 11 +-
8 files changed, 201 insertions(+), 176 deletions(-)
diff --git a/addons/account_followup/account_followup.py b/addons/account_followup/account_followup.py
index a7067bf7a8c..ac117c2b318 100644
--- a/addons/account_followup/account_followup.py
+++ b/addons/account_followup/account_followup.py
@@ -23,7 +23,8 @@ from osv import fields, osv
from datetime import date
import time
import datetime
-
+from lxml import etree
+from copy import deepcopy
from tools.translate import _
@@ -77,6 +78,7 @@ class followup_line(osv.osv):
_defaults = {
'send_email': True,
'send_letter': False,
+ 'manual_action':False,
'description': """
Dear %(partner_name)s,
@@ -122,6 +124,11 @@ followup_line()
class account_move_line(osv.osv):
+ def set_kanban_state_litigation(self, cr, uid, ids, context=None):
+ for l in self.browse(cr, uid, ids, context):
+ self.write(cr, uid, [l.id], {'blocked': not l.blocked})
+ return False
+
def _get_result(self, cr, uid, ids, name, arg, context=None):
res = {}
for aml in self.browse(cr, uid, ids, context):
@@ -155,11 +162,29 @@ email_template()
class res_partner(osv.osv):
+ def fields_view_get(self, cr, uid, view_id=None, view_type=None, context=None, toolbar=False, submenu=False):
+ res = super(res_partner, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context,
+ toolbar=toolbar, submenu=submenu)
+
+ if context:
+ for l in context:
+ print l, context[l]
+ if view_type == 'form' and context and 'search_default_todo' in context.keys():
+ doc = etree.XML(res['arch'], parser=None, base_url=None)
+ first_node = doc.xpath("//page[@string='Payments Follow-up']")
+ first_node[0].set("position", "left")
+ first_node[0].getparent().append(first_node[0])
+ root = first_node[0].getparent()
+ root[0]= root[-1]
+ res['arch'] = etree.tostring(doc)
+ return res
+
+
def _get_latest_followup_date(self, cr, uid, ids, name, arg, context=None):
res = {}
for partner in self.browse(cr, uid, ids, context):
amls = partner.accountmoveline_ids
- res[partner.id] = max([x.followup_date for x in amls]) if len(amls) else False
+ res[partner.id] = max([x.followup_date for x in amls]) if len(amls) else False
return res
@@ -167,6 +192,8 @@ class res_partner(osv.osv):
res = {}
for partner in self.browse(cr, uid, ids, context):
amls = partner.accountmoveline_ids
+
+
level_id = 0
level_days = False
latest_level = False
@@ -188,16 +215,14 @@ class res_partner(osv.osv):
latest_date = False
latest_level = False
latest_level_without_lit = False
- latest_days_without_lit = False
+
for aml in amls:
-
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
- latest_days_without_lit = latest_days
if latest_date and latest_level:
if aml.followup_date > latest_date:
latest_date = aml.followup_date
@@ -206,7 +231,6 @@ class res_partner(osv.osv):
latest_level = aml.followup_line_id.id
if not aml.blocked:
latest_level_without_lit = latest_level
- latest_days_without_lit = latest_days
res[partner.id] = {'latest_followup_date': latest_date,
'latest_followup_level_id': latest_level,
'latest_followup_level_id_without_lit': latest_level_without_lit}
@@ -369,6 +393,14 @@ class res_partner(osv.osv):
partnerlist.append(aml.partner_id.id)
return partnerlist
+ def _get_aml_storeids2(self, cr, uid, ids, context=None):
+ partnerlist = []
+ for aml in self.pool.get("account.move.line").browse(cr, uid, ids, context):
+ if aml.partner_id not in partnerlist:
+ partnerlist.append(aml.partner_id.id)
+ return partnerlist
+
+
def _search_amount(self, cr, uid, obj, name, args, context):
ids = set()
@@ -421,9 +453,10 @@ class res_partner(osv.osv):
string="Next Level", help="The next follow-up level to come when the customer still refuses to pay",
store={'account.move.line': (_get_aml_storeids, ['followup_line_id', 'followup_date'], 10)}),
'payment_amount_overdue':fields.function(_get_amount_overdue, method=True, type='float', string="Amount Overdue",
- help="Amount Overdue: The amount the customer should already have paid",
- store={'account.move.line': (_get_aml_storeids, ['debit', 'credit'], 10)},
+ help="Amount Overdue: The amount the customer owns us",
+ store={'account.move.line': (_get_aml_storeids2, ['followup_line_id', 'followup_date', 'debit', 'credit', 'invoice'], 10)},
),
+
}
res_partner()
diff --git a/addons/account_followup/account_followup_customers.xml b/addons/account_followup/account_followup_customers.xml
index f77729be2e9..d44ccebc7c6 100644
--- a/addons/account_followup/account_followup_customers.xml
+++ b/addons/account_followup/account_followup_customers.xml
@@ -4,67 +4,9 @@
-
-
-
- eee
- res.partner
- form
-
-
-
-
-
+
+
dddres.partner
@@ -98,7 +40,7 @@
Searchres.partnersearch
-
+
@@ -115,7 +57,7 @@
-
+
@@ -172,33 +114,41 @@
res.partner.followup.form.inheritres.partner
-
+
-
-
+
+
The , the latest level that was executed, was .
-
- He still owns us a total amount of
+
+
The partner owns us
-
This is the action required now:
+
-
+
-
-
-
-
+
+ to be done by:
+
+ No action defined right now.
+
+
+
+
+
+
- By clicking on BLUBS, you can put an invoice as litigation. This means you are still in discussion about it
+ By clicking on the light bulb, you can put an invoice as litigation. This means you are still in discussion about it and it
+ won't be taken into account for going to the next follow-up level.
-
+
@@ -252,12 +197,15 @@
-
+
+
+
@@ -267,7 +215,7 @@
-
+
\ No newline at end of file
diff --git a/addons/account_followup/account_followup_data.xml b/addons/account_followup/account_followup_data.xml
index 98e148fde84..a138af60dc6 100644
--- a/addons/account_followup/account_followup_data.xml
+++ b/addons/account_followup/account_followup_data.xml
@@ -42,7 +42,6 @@ ${user.name}
Amount
Lit.
-
<%
amls = object.accountmoveline_ids
mel = {}
@@ -267,7 +266,6 @@ ${mel[aml.id]}
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.
-Best Regards,
Best Regards,
diff --git a/addons/account_followup/account_followup_demo.xml b/addons/account_followup/account_followup_demo.xml
index 0e06f5c5e63..d82f85a0e3d 100644
--- a/addons/account_followup/account_followup_demo.xml
+++ b/addons/account_followup/account_followup_demo.xml
@@ -5,14 +5,14 @@
Default Follow-up
- First letter after 15 net days, 30 net days and 45 days end of month levels.
- Level 0 : 15 days
+ Send first reminder email015
+ True
Dear %(partner_name)s,
@@ -26,11 +26,13 @@ Best Regards,
- Level 1 : 30 days
+ Send reminder letter and email130
+ True
+ True
Dear %(partner_name)s,
@@ -46,13 +48,17 @@ Details of due payments is printed below.
Best Regards,
-
+
+
- Level 2 : 45 days
- 2
- 45
+ Call the customer on the phone
+ 3
+ 40
+
+ True
+ Call the customer on the phone!
Dear %(partner_name)s,
@@ -68,5 +74,51 @@ Best Regards,
+
+ More agressive reminder email
+ 4
+ 50
+
+ True
+
+
+Dear %(partner_name)s,
+
+Despite several reminders, your account is still not settled.
+
+Unless full payment is made in next 8 days, then legal action for the recovery of the debt will be taken without further notice.
+
+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 (+32).10.68.94.39.
+
+Best Regards,
+
+
+
+ More agressive reminder letter
+ 5
+ 60
+
+
+ True
+
+
+Dear %(partner_name)s,
+
+Despite several reminders, your account is still not settled.
+
+Unless full payment is made in next 8 days, then legal action for the recovery of the debt will be taken without further notice.
+
+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 (+32).10.68.94.39.
+
+Best Regards,
+
+
+
+
+
diff --git a/addons/account_followup/account_followup_view.xml b/addons/account_followup/account_followup_view.xml
index c461888bb29..da7ea67e4f1 100644
--- a/addons/account_followup/account_followup_view.xml
+++ b/addons/account_followup/account_followup_view.xml
@@ -23,38 +23,48 @@
@@ -114,24 +135,20 @@
form
- Click to define follow-up levels and their related messages.
+ Click to define follow-up levels and their related actions.
- For each step, specify the message and the day of delay. Use
- the legend to know the using code to adapt the email content to
- the good context (good name, good date) and you can manage the
- multi language of messages.
+ For each step, specify the actions to be taken and delay in days. It is
+ possible to use print and e-mail templates to send specific messages to
+ the customer.
- And again some explanation why this is the greatest wizard of Oz ever.
+ 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.