[MERGE] Dev3 branch => Account followup: Overall cleaning and improvements

bzr revid: mra@mra-laptop-20100703093526-n85gp9fs30t74sxz
This commit is contained in:
Mustufa Rangwala 2010-07-03 15:05:26 +05:30
commit 0813589008
11 changed files with 102 additions and 83 deletions

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@ -15,14 +15,13 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import followup
import followup_report
import account_followup
import account_followup_report
import wizard
import report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -19,7 +19,6 @@
#
##############################################################################
{
'name': 'Accounting follow-ups management',
'version': '1.0',
@ -36,11 +35,10 @@
It will generate a PDF with all the letters according the the
different levels of recall defined. You can define different policies
for different companies.
for different companies. You can send also mail to the customer.
Note that if you want to change the followup level for a given partner/account entry, you can do it in the menu:
Financial Management/Reporting/Follow-Ups/All receivable entries
Accounting/Reporting/Follow-Ups/All receivable entries
""",
'author': 'Tiny',
@ -50,13 +48,14 @@
'update_xml': [
'security/ir.model.access.csv',
'wizard/account_followup_print_view.xml',
'followup_report_view.xml',
'followup_view.xml',
'followup_data.xml'
'account_followup_report.xml',
'account_followup_view.xml',
'account_followup_data.xml'
],
'demo_xml': ['followup_demo.xml'],
'demo_xml': ['account_followup_demo.xml'],
'installable': True,
'active': False,
'certificate': '0072481076453',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@ -15,7 +15,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
@ -23,13 +23,17 @@ from osv import fields, osv
class followup(osv.osv):
_name = 'account_followup.followup'
_description = 'Follow-Up'
_description = 'Account Follow Up'
_columns = {
'name': fields.char('Name', size=64, required=True),
'description': fields.text('Description'),
'followup_line': fields.one2many('account_followup.followup.line', 'followup_id', 'Follow-Up'),
'company_id': fields.many2one('res.company', 'Company'),
}
_defaults = {
'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'account_followup.followup', context=c),
}
followup()
class followup_line(osv.osv):
@ -42,26 +46,27 @@ class followup_line(osv.osv):
'start': fields.selection([('days','Net Days'),('end_of_month','End of Month')], 'Type of Term', size=64, required=True),
'followup_id': fields.many2one('account_followup.followup', 'Follow Ups', required=True, ondelete="cascade"),
'description': fields.text('Printed Message', translate=True),
}
}
followup_line()
class account_move_line(osv.osv):
_name = 'account.move.line'
_inherit = 'account.move.line'
_columns = {
'followup_line_id': fields.many2one('account_followup.followup.line', 'Follow-up Level'),
'followup_date': fields.date('Latest Follow-up'),
}
}
account_move_line()
class res_company(osv.osv):
_inherit = "res.company"
_columns = {
'follow_up_msg' : fields.text('Follow-up Message', translate=True),
}
}
_defaults = {
'overdue_msg': lambda *a: '''
'overdue_msg': '''
Date : %(date)s
Dear %(partner_name)s,
@ -75,8 +80,8 @@ Thanks,
%(user_signature)s
%(company_name)s
'''
}
}
res_company()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_account_followup_followup_line_tree" model="ir.ui.view">
<field name="name">account_followup.followup.line.tree</field>
<field name="model">account_followup.followup.line</field>
@ -15,40 +15,39 @@
</tree>
</field>
</record>
<record id="view_account_followup_followup_line_form" model="ir.ui.view">
<field name="name">account_followup.followup.line.form</field>
<field name="model">account_followup.followup.line</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Follow-Up Lines">
<field name="sequence" select="1"/>
<field name="name" select="1"/>
<field name="delay" select="1"/>
<field name="start" select="1"/>
<field name="sequence"/>
<field name="name" />
<field name="delay" />
<field name="start" />
<newline/>
<field colspan="4" name="description" select="1"/>
<field colspan="4" name="description" />
<separator string="Legend" colspan="4"/>
<label string="%%(partner_name)s: Partner name" colspan="2"/>
<label string="%%(partner_name)s: Partner Name" colspan="2"/>
<label string="%%(date)s: Current Date" colspan="2"/>
<label string="%%(user_signature)s: User name" colspan="2"/>
<label string="%%(company_name)s: User's Company name" colspan="2"/>
<label string="%%(user_signature)s: User Name" colspan="2"/>
<label string="%%(company_name)s: User's Company Name" colspan="2"/>
</form>
</field>
</record>
<record id="view_account_followup_followup_form" model="ir.ui.view">
<field name="name">account_followup.followup.form</field>
<field name="model">account_followup.followup</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Follow-Up">
<field name="name" select="1"/>
<field name="company_id" select="1" widget="selection" groups="base.group_multi_company"/>
<field name="name" />
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<separator colspan="4" string="Description"/>
<field colspan="4" name="description" nolabel="1" select="1"/>
<separator colspan="4" string="Lines"/>
<field colspan="4" name="description" nolabel="1" />
<separator colspan="4" string="Followup Lines"/>
<field colspan="4" name="followup_line" nolabel="1"/>
</form>
</field>
@ -66,17 +65,30 @@
</field>
</record>
<record id="view_account_followup_filter" model="ir.ui.view">
<field name="name">account.followup.select</field>
<field name="model">account_followup.followup</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Followup">
<group col="10" colspan="4">
<field name="name"/>
</group>
</search>
</field>
</record>
<record id="action_account_followup_definition_form" model="ir.actions.act_window">
<field name="name">Follow-Ups</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account_followup.followup</field>
<field name="search_view_id" ref="view_account_followup_filter"/>
<field name="view_type">form</field>
</record>
<menuitem action="action_account_followup_definition_form" id="account_followup_menu" parent="account.menu_finance_configuration"/>
<report auto="False" id="account_followup_followup_report" menu="False" model="account_followup.followup" name="account_followup.followup.print" rml="account_followup/report/rappel.rml" string="Followup Report"/>
<record id="account_move_line_partner_tree" model="ir.ui.view">
<field name="name">account.move.line.partner.tree</field>
<field name="model">account.move.line</field>
@ -99,7 +111,7 @@
</tree>
</field>
</record>
<record id="view_move_line_form" model="ir.ui.view">
<field name="name">account.move.line.form.followup</field>
<field name="model">account.move.line</field>
@ -111,7 +123,7 @@
</field>
</field>
</record>
<record id="view_move_line_tree" model="ir.ui.view">
<field name="name">account.move.line.tree.followup</field>
<field name="model">account.move.line</field>
@ -123,17 +135,17 @@
</field>
</field>
</record>
<act_window domain="[('partner_id', '=', active_id),('reconcile_id','=',False),('account_id.reconcile', '=', True),('account_id.type', 'in', ['receivable', 'payable'])]" id="account.act_account_partner_account_move_unreconciled" name="Receivables &amp; Payables" res_model="account.move.line" view="account_move_line_partner_tree"/>
<act_window domain="[('reconcile_id', '=', False),('account_id.type','=','receivable')]" id="act_account_partner_account_move_all" name="All receivable entries" res_model="account.move.line" src_model="" view="account_move_line_partner_tree"/>
<menuitem action="act_account_partner_account_move_all" id="menu_account_move_open_unreconcile" parent="account_followup.menu_action_followup_stat"/>
<act_window domain="[('reconcile_id', '=', False), ('account_id.type','=','payable')]" id="act_account_partner_account_move_payable_all" name="All payable entries" res_model="account.move.line" src_model="" view="account_move_line_partner_tree"/>
<menuitem action="act_account_partner_account_move_payable_all" id="menu_account_move_open_unreconcile_payable" parent="account_followup.menu_action_followup_stat"/>
<record model="ir.ui.view" id="view_company_inherit_followup_form">
<field name="name">res.company.followup.form.inherit</field>
<field name="inherit_id" ref="account.view_company_inherit_form"/>
@ -146,5 +158,6 @@
</field>
</field>
</record>
</data>
</openerp>

View File

@ -30,12 +30,12 @@ class report_rappel(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(report_rappel, self).__init__(cr, uid, name, context=context)
self.localcontext.update( {
'time' : time,
'time': time,
'ids_to_objects': self._ids_to_objects,
'adr_get' : self._adr_get,
'getLines' : self._lines_get,
'get_text' : self._get_text
})
'adr_get': self._adr_get,
'getLines': self._lines_get,
'get_text': self._get_text
})
def _ids_to_objects(self, partners_ids):
pool = pooler.get_pool(self.cr.dbname)
@ -91,10 +91,8 @@ class report_rappel(report_sxw.rml_parse):
return text
report_sxw.report_sxw('report.account_followup.followup.print',
'res.partner', 'addons/account_followup/report/rappel.rml',
parser=report_rappel)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -34,25 +34,32 @@ class account_followup_print(osv.osv_memory):
}
def _get_followup(self, cr, uid, context=None):
if context is None:
context = {}
if context.get('active_model', 'ir.ui.menu') == 'account_followup.followup':
return context.get('active_id', False)
company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id
tmp = self.pool.get('account_followup.followup').search(cr, uid, [('company_id', '=', company_id)])
return tmp and tmp[0] or False
followp_id = self.pool.get('account_followup.followup').search(cr, uid, [('company_id', '=', company_id)], context=context)
return followp_id and followp_id[0] or False
def do_continue(self, cr, uid, ids, context=None):
mod_obj = self.pool.get('ir.model.data')
if context is None:
context = {}
data = self.read(cr, uid, ids, [])[0]
model_data_ids = mod_obj.search(cr, uid, [('model','=','ir.ui.view'),('name','=','view_account_followup_print_all')], context=context)
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
context.update({'followup_id': data['followup_id'], 'date':data['date']})
return {
'name': _('Select partners'),
'view_type': 'form',
'context': context,
'view_mode': 'tree,form',
'res_model': 'account.followup.print.all',
'views': [(resource_id,'form')],
'type': 'ir.actions.act_window',
'target': 'new',
'name': _('Select Partners'),
'view_type': 'form',
'context': context,
'view_mode': 'tree,form',
'res_model': 'account.followup.print.all',
'views': [(resource_id,'form')],
'type': 'ir.actions.act_window',
'target': 'new',
}
_defaults = {
@ -74,10 +81,12 @@ class account_followup_print_all(osv.osv_memory):
'summary': fields.text('Summary', required=True, readonly=True)
}
def _get_summary(self, cr, uid, context=None):
if context is None:
context = {}
return context.get('summary', '')
def _get_partners(self, cr, uid, context=None):
return self._get_partners_followp(cr, uid, [], context)['partner_ids']
return self._get_partners_followp(cr, uid, [], context=context)['partner_ids']
def _get_msg(self, cr, uid, context=None):
return self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.follow_up_msg
@ -168,6 +177,9 @@ class account_followup_print_all(osv.osv_memory):
move_obj = self.pool.get('account.move.line')
user_obj = self.pool.get('res.users')
line_obj = self.pool.get('account_followup.stat')
if context is None:
context = {}
data = self.read(cr, uid, ids, [])[0]
model_data_ids = mod_obj.search(cr, uid, [('model','=','ir.ui.view'),('name','=','view_account_followup_print_all_msg')], context=context)
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
@ -252,8 +264,9 @@ class account_followup_print_all(osv.osv_memory):
context.update({'summary': summary})
else:
context.update({'summary': '\n\n\nE-Mail has not been sent to any partner. If you want to send it, please tick send email confirmation on wizard.'})
return {
'name': _('Summary'),
'name': _('Follwoup Summary'),
'view_type': 'form',
'context': context,
'view_mode': 'tree,form',
@ -265,6 +278,8 @@ class account_followup_print_all(osv.osv_memory):
}
def do_print(self, cr, uid, ids, context=None):
if context is None:
context = {}
data = self.read(cr, uid, ids, [])[0]
res = self._get_partners_followp(cr, uid, ids, context)['to_update']
to_update = res
@ -284,6 +299,7 @@ class account_followup_print_all(osv.osv_memory):
'model': 'account_followup.followup',
'form': data
}
return {
'type': 'ir.actions.report.xml',
'report_name': 'account_followup.followup.print',

View File

@ -2,17 +2,6 @@
<openerp>
<data noupdate="0">
<!--<wizard string="Send followups"
name="account_followup.followup.print.all"
id="action_account_followup_all_wizard"
model="account_followup.followup" />
<menuitem action="action_account_followup_all_wizard"
id="account_followup_wizard_menu"
parent="account.menu_finance_periodical_processing"
type="wizard" />-->
<record id="view_account_followup_print" model="ir.ui.view">
<field name="name">account.followup.print.form</field>
<field name="model">account.followup.print</field>