Better and good account followup module.
bzr revid: fp@tinyerp.com-664ed0baf580314d0bae74274e466ca41d0f9ba9
This commit is contained in:
@@ -27,5 +27,6 @@
|
||||
##############################################################################
|
||||
|
||||
import followup
|
||||
import followup_report
|
||||
import wizard
|
||||
import report
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
import ir
|
||||
|
||||
class followup(osv.osv):
|
||||
_name = 'account_followup.followup'
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="32"/>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Partner entries">
|
||||
<tree string="Partner entries" editable="bottom">
|
||||
<field name="date"/>
|
||||
<field name="move_id"/>
|
||||
<field name="ref"/>
|
||||
@@ -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"/>
|
||||
|
||||
<act_window name="All account entries"
|
||||
domain="[('reconcile_id', '=', False),('account_id','=','type:receivable')]"
|
||||
res_model="account.move.line"
|
||||
src_model="res.partner"
|
||||
view_id="account_move_line_partner_tree"
|
||||
view="account_move_line_partner_tree"
|
||||
id="act_account_partner_account_move_all"/>
|
||||
|
||||
<menuitem
|
||||
@@ -108,7 +108,7 @@
|
||||
domain="[('reconcile_id', '=', False),('account_id','=','type:payable')]"
|
||||
res_model="account.move.line"
|
||||
src_model="res.partner"
|
||||
view_id="account_move_line_partner_tree"
|
||||
view="account_move_line_partner_tree"
|
||||
id="act_account_partner_account_move_payable_all"/>
|
||||
|
||||
<menuitem
|
||||
|
||||
@@ -29,28 +29,28 @@ import wizard
|
||||
import datetime
|
||||
import pooler
|
||||
|
||||
_followup_wizard_all_form = """<?xml version="1.0"?>
|
||||
<form string="Select partners" colspan="4">
|
||||
<field name="partner_ids"/>
|
||||
</form>"""
|
||||
|
||||
_followup_wizard_all_fields = {
|
||||
'partner_ids': {
|
||||
'string': "Partners",
|
||||
'type': 'many2many',
|
||||
'relation': 'account_followup.stat',
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
class followup_all_print(wizard.interface):
|
||||
# _followup_wizard_all_form = """<?xml version="1.0"?>
|
||||
#<form string="Parameters" colspan="4">
|
||||
# <field name="type"/>
|
||||
#</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'},
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user