diff --git a/addons/account_followup/__init__.py b/addons/account_followup/__init__.py index 217e5c82906..20bc690f225 100644 --- a/addons/account_followup/__init__.py +++ b/addons/account_followup/__init__.py @@ -27,5 +27,6 @@ ############################################################################## import followup +import followup_report import wizard import report diff --git a/addons/account_followup/__terp__.py b/addons/account_followup/__terp__.py index 4c367f5b52b..146622c85e8 100644 --- a/addons/account_followup/__terp__.py +++ b/addons/account_followup/__terp__.py @@ -20,7 +20,10 @@ "category" : "Generic Modules/Accounting", "init_xml" : [], "demo_xml" : ["followup_demo.xml"], - "update_xml" : ["followup_view.xml"], + "update_xml" : [ + "followup_view.xml", + "followup_report_view.xml" + ], "active": False, "installable": True } diff --git a/addons/account_followup/followup.py b/addons/account_followup/followup.py index 836c292694b..4733013b5f9 100644 --- a/addons/account_followup/followup.py +++ b/addons/account_followup/followup.py @@ -29,7 +29,6 @@ ############################################################################## from osv import fields, osv -import ir class followup(osv.osv): _name = 'account_followup.followup' diff --git a/addons/account_followup/followup_view.xml b/addons/account_followup/followup_view.xml index ea1987706db..e5340d62b54 100644 --- a/addons/account_followup/followup_view.xml +++ b/addons/account_followup/followup_view.xml @@ -68,7 +68,7 @@ tree - + @@ -89,14 +89,14 @@ domain="[('partner_id', '=', active_id),('account_id','=','partner:'+str(active_id)),('reconcile_id','=',False)]" res_model="account.move.line" src_model="res.partner" - view_id="account_move_line_partner_tree" + view="account_move_line_partner_tree" id="account.act_account_partner_account_move_unreconciled"/> +
+ +""" + +_followup_wizard_all_fields = { + 'partner_ids': { + 'string': "Partners", + 'type': 'many2many', + 'relation': 'account_followup.stat', + }, +} + + class followup_all_print(wizard.interface): -# _followup_wizard_all_form = """ -#
-# -#""" -# -# _followup_wizard_all_fields = { -# 'type': { -# 'string': "Follow up base on", -# 'type': 'selection', -# 'selection': [('maturity', 'Maturity date'), -# ('date', 'Creation Date')] -# }, -# } + def _get_partners(self, cr, uid, data, context): + cr.execute('select id from account_followup_stat') + ids = map(lambda x: x[0], cr.fetchall()) + return {'partner_ids': ids} - - # this method gets the list of all partners who need a follow up of any - # level AND marks the movelines of thoses partners with the current date - # and the level of followup reached -#CHECKME: shouldn't we also make sure that partners owe us money, and not the -# opposite? - def _get_all_partners(self, cr, uid, data, context): + def _update_partners(self, cr, uid, data, context): + partner_ids = data['form']['partner_ids'][0][2] cr.execute( "SELECT l.partner_id, l.followup_line_id, l.date, l.id "\ "FROM account_move_line AS l LEFT JOIN account_account AS a "\ @@ -58,6 +58,7 @@ class followup_all_print(wizard.interface): "WHERE (l.reconcile_id IS NULL) "\ "AND (a.type='receivable') AND (l.debit > 0) "\ "AND (l.state<>'draft') "\ + "AND partner_id in ("+','.join(map(str,partner_ids))+") "\ "ORDER BY l.date") move_lines = cr.fetchall() @@ -67,8 +68,6 @@ class followup_all_print(wizard.interface): if not fup_ids: raise wizard.except_wizard('No Follow up Defined', 'You must define at least one follow up for your company !') - - #Ged> DUH! fup_id = fup_ids[0] # fups = { @@ -124,13 +123,16 @@ class followup_all_print(wizard.interface): return {'partner_id': partner_list} states = { - #'init' : { - # 'actions': [], - # 'result': {'type': 'form', 'arch':_followup_wizard_all_form, 'fields':_followup_wizard_all_fields, 'state':[('end','Cancel'),('print','Print Follow Ups')]}, - #}, - #'print' : { - 'init': { - 'actions': [_get_all_partners], + 'init' : { + 'actions': [_get_partners], + 'result': {'type': 'form', + 'arch':_followup_wizard_all_form, + 'fields':_followup_wizard_all_fields, + 'state':[('end','Cancel'),('print','Print Follow Ups')] + }, + }, + 'print': { + 'actions': [_update_partners], 'result': {'type':'print', 'report':'account_followup.followup.print', 'state':'end'}, },