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 @@
-
-
- The The partner owns us This is the action required 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.
+
- 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.
-