[IMP] Clean-up continued
bzr revid: jco@openerp.com-20121123171236-287mx56ecw8av02p
This commit is contained in:
@@ -29,19 +29,18 @@ Module to automate letters for unpaid invoices, with multi-level recalls.
|
||||
|
||||
You can define your multiple levels of recall through the menu:
|
||||
---------------------------------------------------------------
|
||||
**Invoicing** / **Configuration** / **Miscellaneous** / **Follow-ups**
|
||||
|
||||
Configuration / Follow-Up Levels
|
||||
|
||||
Once it is defined, you can automatically print recalls every day through simply clicking on the menu:
|
||||
------------------------------------------------------------------------------------------------------
|
||||
**Invoicing** / **Periodical Processing** / **Billing** / **Send follow-ups**
|
||||
Payment Follow-Up / Send Email and letters
|
||||
|
||||
It will generate a PDF with all the letters according to the the different levels
|
||||
of recall defined. You can define different policies for different companies. You
|
||||
can also send mail to the customer.
|
||||
It will generate a PDF / send emails / set manual actions according to the the different levels
|
||||
of recall defined. You can define different policies for different companies.
|
||||
|
||||
Note that if you want to check the follow-up level for a given partner/account entry, you can do from in the menu:
|
||||
------------------------------------------------------------------------------------------------------------------
|
||||
**Invoicing** / **Reporting** / **Generic Reporting** / **Partners** / **Follow-ups Sent**
|
||||
Reporting / Accounting / **Follow-ups Analysis
|
||||
|
||||
""",
|
||||
'author': 'OpenERP SA',
|
||||
@@ -53,15 +52,15 @@ Note that if you want to check the follow-up level for a given partner/account e
|
||||
'security/ir.model.access.csv',
|
||||
'report/account_followup_report.xml',
|
||||
'account_followup_data.xml',
|
||||
'account_followup_demo.xml', # Defined by default
|
||||
|
||||
'account_followup_view.xml',
|
||||
'account_followup_customers.xml',
|
||||
'wizard/account_followup_print_view.xml',
|
||||
],
|
||||
'demo': [],
|
||||
'demo': ['account_followup_demo.xml'],
|
||||
'test': [
|
||||
'test/account_followup.yml',
|
||||
'test/account_followup_report.yml',
|
||||
#TODO 'test/account_followup_report.yml', --> Need to wait for second step in order to check report (expects after first)
|
||||
],
|
||||
'installable': True,
|
||||
'auto_install': False,
|
||||
|
||||
@@ -24,7 +24,6 @@ from lxml import etree
|
||||
|
||||
from tools.translate import _
|
||||
|
||||
#TODO: remove trailing spaces and commented code
|
||||
|
||||
class followup(osv.osv):
|
||||
_name = 'account_followup.followup'
|
||||
@@ -136,7 +135,6 @@ email_template()
|
||||
|
||||
class res_partner(osv.osv):
|
||||
|
||||
#TODO: that was not what we decided...
|
||||
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)
|
||||
@@ -150,7 +148,6 @@ class res_partner(osv.osv):
|
||||
|
||||
|
||||
|
||||
#TODO: refactor these functions: remove this one, rework _get_latest and _get_next_followup_level_id must call _get_latest
|
||||
|
||||
def get_latest_from_company(self, cr, uid, ids, names, arg, context=None, company_id=None):
|
||||
res={}
|
||||
@@ -212,7 +209,6 @@ class res_partner(osv.osv):
|
||||
|
||||
|
||||
|
||||
#TODO: to refactor and to comment. I don't get the 'else' statements...
|
||||
def do_partner_manual_action(self, cr, uid, partner_ids, context=None):
|
||||
#partner_ids -> res.partner
|
||||
for partner in self.browse(cr, uid, partner_ids, context=context):
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Mail template is done in a NOUPDATE block
|
||||
so users can freely customize/delete them -->
|
||||
<data noupdate="1">
|
||||
|
||||
<!--Mail template level 0-->
|
||||
<record id="email_template_account_followup_level0" model="email.template">
|
||||
<field name="name">Follow-up of overdue invoices level 0</field>
|
||||
@@ -32,15 +35,13 @@ ${user.name}
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<table border="2" width=100%>
|
||||
|
||||
<tr>
|
||||
<td>Invoice date</td>
|
||||
<td>Reference</td>
|
||||
<td>Due date</td>
|
||||
<td>Amount</td>
|
||||
<td>Amount</td>
|
||||
<td>Lit.</td>
|
||||
</tr>
|
||||
|
||||
@@ -48,7 +49,7 @@ ${user.name}
|
||||
amls = object.unreconciled_aml_ids
|
||||
mel = {}
|
||||
total = 0
|
||||
for aml in amls:
|
||||
for aml in amls:
|
||||
strbegin = "<TD> "
|
||||
strend = "</TD> "
|
||||
date = False
|
||||
@@ -128,7 +129,7 @@ ${user.name}
|
||||
<td>Invoice date</td>
|
||||
<td>Reference</td>
|
||||
<td>Due date</td>
|
||||
<td>Amount</td>
|
||||
<td>Amount</td>
|
||||
<td>Lit.</td>
|
||||
</tr>
|
||||
|
||||
@@ -136,7 +137,7 @@ ${user.name}
|
||||
amls = object.unreconciled_aml_ids
|
||||
mel = {}
|
||||
total = 0
|
||||
for aml in amls:
|
||||
for aml in amls:
|
||||
strbegin = "<TD> "
|
||||
strend = "</TD> "
|
||||
date = False
|
||||
@@ -211,7 +212,7 @@ ${user.name}
|
||||
<td>Invoice date</td>
|
||||
<td>Reference</td>
|
||||
<td>Due date</td>
|
||||
<td>Amount</td>
|
||||
<td>Amount</td>
|
||||
<td>Lit.</td>
|
||||
</tr>
|
||||
|
||||
@@ -219,7 +220,7 @@ ${user.name}
|
||||
amls = object.unreconciled_aml_ids
|
||||
mel = {}
|
||||
total = 0
|
||||
for aml in amls:
|
||||
for aml in amls:
|
||||
strbegin = "<TD> "
|
||||
strend = "</TD> "
|
||||
date = False
|
||||
@@ -252,7 +253,7 @@ ${mel[aml.id]}
|
||||
% endfor
|
||||
|
||||
</table>
|
||||
<center>Amount due: ${total} ${object.company_id.currency_id.name} </center>
|
||||
<center>Amount due: ${total} ${object.company_id.currency_id.name} </center>
|
||||
<br/>
|
||||
|
||||
</div>
|
||||
@@ -296,7 +297,7 @@ ${user.name}
|
||||
<td>Invoice date</td>
|
||||
<td>Reference</td>
|
||||
<td>Due date</td>
|
||||
<td>Amount</td>
|
||||
<td>Amount</td>
|
||||
<td>Lit.</td>
|
||||
</tr>
|
||||
|
||||
@@ -346,5 +347,78 @@ ${mel[aml.id]}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<record id="demo_followup1" model="account_followup.followup">
|
||||
<field name="name">Default Follow-up</field>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
</record>
|
||||
|
||||
<record id="demo_followup_line1" model="account_followup.followup.line">
|
||||
<field name="name">Send first reminder email</field>
|
||||
<field name="sequence">0</field>
|
||||
<field name="delay">15</field>
|
||||
<field name="followup_id" ref="demo_followup1"/>
|
||||
<field name="send-email">True</field>
|
||||
<field name="description">
|
||||
Dear %(partner_name)s,
|
||||
|
||||
Exception made if there was a mistake of ours, it seems that the following amount stays unpaid. Please, take 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,
|
||||
</field>
|
||||
<field name="email_template_id" ref="email_template_account_followup_level0"/>
|
||||
</record>
|
||||
|
||||
<record id="demo_followup_line2" model="account_followup.followup.line">
|
||||
<field name="name">Send reminder letter and email</field>
|
||||
<field name="sequence">1</field>
|
||||
<field name="delay">30</field>
|
||||
<field name="followup_id" ref="demo_followup1"/>
|
||||
<field name="email_template_id" ref="email_template_account_followup_level1"/>
|
||||
<field name="send_email">True</field>
|
||||
<field name="send_letter">True</field>
|
||||
<field name="description">
|
||||
Dear %(partner_name)s,
|
||||
|
||||
We are disappointed to see that despite sending a reminder, that your account is now seriously overdue.
|
||||
|
||||
It is essential that immediate payment is made, otherwise we will have to consider placing a stop on your account which means that we will no longer be able to supply your company with (goods/services).
|
||||
Please, take appropriate measures in order to carry out this payment in the next 8 days.
|
||||
|
||||
If there is a problem with paying invoice that we are not aware of, do not hesitate to contact our accounting department at (+32).10.68.94.39. so that we can resolve the matter quickly.
|
||||
|
||||
Details of due payments is printed below.
|
||||
|
||||
Best Regards,
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="demo_followup_line3" model="account_followup.followup.line">
|
||||
<field name="name">Call the customer on the phone</field>
|
||||
<field name="sequence">3</field>
|
||||
<field name="delay">40</field>
|
||||
<field name="followup_id" ref="demo_followup1"/>
|
||||
<field name="email_template_id" ref="email_template_account_followup_level2"/>
|
||||
<field eval="False" name="send_email"/>
|
||||
<field name="manual_action">True</field>
|
||||
<field name="manual_action_note">Call the customer on the phone! </field>
|
||||
<field name="description">
|
||||
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,
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -1,79 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
|
||||
<record id="demo_followup1" model="account_followup.followup">
|
||||
<field name="name">Default Follow-up</field>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
</record>
|
||||
|
||||
<record id="demo_followup_line1" model="account_followup.followup.line">
|
||||
<field name="name">Send first reminder email</field>
|
||||
<field name="sequence">0</field>
|
||||
<field name="delay">15</field>
|
||||
<field name="followup_id" ref="demo_followup1"/>
|
||||
<field name="send-email">True</field>
|
||||
<field name="description">
|
||||
Dear %(partner_name)s,
|
||||
|
||||
Exception made if there was a mistake of ours, it seems that the following amount stays unpaid. Please, take 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,
|
||||
</field>
|
||||
<field name="email_template_id" ref="email_template_account_followup_level0"/>
|
||||
</record>
|
||||
|
||||
<record id="demo_followup_line2" model="account_followup.followup.line">
|
||||
<field name="name">Send reminder letter and email</field>
|
||||
<field name="sequence">1</field>
|
||||
<field name="delay">30</field>
|
||||
<field name="followup_id" ref="demo_followup1"/>
|
||||
<field name="email_template_id" ref="email_template_account_followup_level1"/>
|
||||
<field name="send_email">True</field>
|
||||
<field name="send_letter">True</field>
|
||||
<field name="description">
|
||||
Dear %(partner_name)s,
|
||||
|
||||
We are disappointed to see that despite sending a reminder, that your account is now seriously overdue.
|
||||
|
||||
It is essential that immediate payment is made, otherwise we will have to consider placing a stop on your account which means that we will no longer be able to supply your company with (goods/services).
|
||||
Please, take appropriate measures in order to carry out this payment in the next 8 days.
|
||||
|
||||
If there is a problem with paying invoice that we are not aware of, do not hesitate to contact our accounting department at (+32).10.68.94.39. so that we can resolve the matter quickly.
|
||||
|
||||
Details of due payments is printed below.
|
||||
|
||||
Best Regards,
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="demo_followup_line3" model="account_followup.followup.line">
|
||||
<field name="name">Call the customer on the phone</field>
|
||||
<field name="sequence">3</field>
|
||||
<field name="delay">40</field>
|
||||
<field name="followup_id" ref="demo_followup1"/>
|
||||
<field name="email_template_id" ref="email_template_account_followup_level2"/>
|
||||
<field eval="False" name="send_email"/>
|
||||
<field name="manual_action">True</field>
|
||||
<field name="manual_action_note">Call the customer on the phone! </field>
|
||||
<field name="description">
|
||||
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,
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<data noupdate="1">
|
||||
<record id="demo_followup_line4" model="account_followup.followup.line">
|
||||
<field name="name">More agressive reminder email</field>
|
||||
<field name="sequence">4</field>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<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>
|
||||
|
||||
@@ -116,16 +116,21 @@ class account_followup_print(osv.osv_memory):
|
||||
_name = 'account.followup.print'
|
||||
_description = 'Print Follow-up & Send Mail to Customers'
|
||||
_columns = {
|
||||
'date': fields.date('Follow-up Sending Date', required=True, help="This field allow you to select a forecast date to plan your follow-ups"),
|
||||
'date': fields.date('Follow-up Sending Date', required=True,
|
||||
help="This field allow you to select a forecast date to plan your follow-ups"),
|
||||
'followup_id': fields.many2one('account_followup.followup', 'Follow-Up', required=True, readonly = True),
|
||||
'partner_ids': fields.many2many('account_followup.stat.by.partner', 'partner_stat_rel', 'osv_memory_id', 'partner_id', 'Partners', required=True),
|
||||
'company_id':fields.related('followup_id', 'company_id', type='many2one', relation='res.company', store=True, readonly=True),
|
||||
'partner_ids': fields.many2many('account_followup.stat.by.partner', 'partner_stat_rel',
|
||||
'osv_memory_id', 'partner_id', 'Partners', required=True),
|
||||
'company_id':fields.related('followup_id', 'company_id', type='many2one',
|
||||
relation='res.company', store=True, readonly=True),
|
||||
'email_conf': fields.boolean('Send Email Confirmation'),
|
||||
'email_subject': fields.char('Email Subject', size=64),
|
||||
'partner_lang': fields.boolean('Send Email in Partner Language', help='Do not change message text, if you want to send email in partner language, or configure from company'),
|
||||
'partner_lang': fields.boolean('Send Email in Partner Language',
|
||||
help='Do not change message text, if you want to send email in partner language, or configure from company'),
|
||||
'email_body': fields.text('Email Body'),
|
||||
'summary': fields.text('Summary', readonly=True),
|
||||
'test_print': fields.boolean('Test Print', help='Check if you want to print follow-ups without changing follow-ups level.'),
|
||||
'test_print': fields.boolean('Test Print',
|
||||
help='Check if you want to print follow-ups without changing follow-ups level.'),
|
||||
}
|
||||
|
||||
def _get_followup(self, cr, uid, context=None):
|
||||
@@ -167,10 +172,10 @@ class account_followup_print(osv.osv_memory):
|
||||
message = _("Follow-up letter of ") + "<I> " + partner.partner_id.latest_followup_level_id_without_lit.name + "</I>" + _(" will be sent")
|
||||
partner_obj.message_post(cr, uid, [partner.partner_id.id], body=message, context=context)
|
||||
if nbunknownmails == 0:
|
||||
resulttext += str(nbmails) + _(" emails sent")
|
||||
resulttext += str(nbmails) + _(" email(s) sent")
|
||||
else:
|
||||
resulttext += str(nbmails) + _(" emails should have been sent, but ") + str(nbunknownmails) + _(" had unknown email addresses") + "\n <BR/> "
|
||||
resulttext += "<BR/>" + str(nbprints) + _(" letters in report") + " \n <BR/>" + str(nbmanuals) + _(" total manual action(s) assigned:")
|
||||
resulttext += str(nbmails) + _(" email(s) should have been sent, but ") + str(nbunknownmails) + _(" had unknown email address(es)") + "\n <BR/> "
|
||||
resulttext += "<BR/>" + str(nbprints) + _(" letter(s) in report") + " \n <BR/>" + str(nbmanuals) + _(" manual action(s) assigned:")
|
||||
needprinting = False
|
||||
if nbprints > 0:
|
||||
needprinting = True
|
||||
@@ -268,11 +273,6 @@ class account_followup_print(osv.osv_memory):
|
||||
for result in cr.dictfetchall():
|
||||
delay = datetime.timedelta(days=result['delay'])
|
||||
fups[old] = (current_date - delay, result['id'])
|
||||
#if result['start'] == 'end_of_month': -> did not do anything
|
||||
# print "Important date change start:", fups[old][0]#.strftime("%Y-%m%-%d")
|
||||
# fups[old][0].replace(day=1)
|
||||
# print "Important date change end:", fups[old][0]#.strftime("%Y-%m%-%d")
|
||||
#fups[old][0] = fups[old][0] + datetime.timedelta(months=1)
|
||||
old = result['id']
|
||||
#fups[old] = (datetime.date(datetime.MAXYEAR, 12, 31), old) --> By commenting this, last level won't be printed again and again
|
||||
fups
|
||||
|
||||
@@ -10,17 +10,17 @@
|
||||
<group col="4">
|
||||
<field name="followup_id" groups="base.group_multi_company"/>
|
||||
<field name="date" groups="base.group_no_one"/>
|
||||
</group>
|
||||
<p class ="oe_grey">
|
||||
When you hit the button below, for every partner the most overdue invoice (without litigation) is checked.
|
||||
If the amount of days overdue is greater or equal than the amount of days specified by a next follow-up level,
|
||||
it will be updated to that next level and the actions of that level will be executed. (See Configuration > Follow-up Levels)
|
||||
</p>
|
||||
<footer>
|
||||
<button name="do_process" string="Send emails and generate letters" type="object" class="oe_highlight"/>
|
||||
or
|
||||
<button string="Cancel" class="oe_link" special="cancel"/>
|
||||
</footer>
|
||||
</group>
|
||||
<p class ="oe_grey">
|
||||
When you hit the button below, for every partner the most overdue invoice (without litigation) is checked.
|
||||
If the amount of days overdue is greater or equal than the amount of days specified by a next follow-up level,
|
||||
it will be updated to that next level and the actions of that level will be executed. (See Configuration > Follow-up Levels)
|
||||
</p>
|
||||
<footer>
|
||||
<button name="do_process" string="Send emails and generate letters" type="object" class="oe_highlight"/>
|
||||
or
|
||||
<button string="Cancel" class="oe_link" special="cancel"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
@@ -54,7 +54,6 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Screen2 -->
|
||||
<record id="account_followup_stat_by_partner_tree" model="ir.ui.view">
|
||||
<field name="name">account_followup.stat.by.partner.tree</field>
|
||||
<field name="model">account_followup.stat.by.partner</field>
|
||||
@@ -79,17 +78,16 @@
|
||||
<field name="description" widget="html" class="oe_view_only"/>
|
||||
</header>
|
||||
<footer>
|
||||
<field name="needprinting" invisible="1"/>
|
||||
<div attrs="{'invisible':[('needprinting','=', False)]}">
|
||||
<button name="do_report" string="Download Letters" type="object" class="oe_highlight"/>
|
||||
</div>
|
||||
<div attrs="{'invisible':[('needprinting','!=', False)]}">
|
||||
<button name="do_done" string="Close" type="object" class="oe_highlight"/>
|
||||
</div>
|
||||
<field name="needprinting" invisible="1"/>
|
||||
<div attrs="{'invisible':[('needprinting','=', False)]}">
|
||||
<button name="do_report" string="Download Letters" type="object" class="oe_highlight"/>
|
||||
</div>
|
||||
<div attrs="{'invisible':[('needprinting','!=', False)]}">
|
||||
<button name="do_done" string="Close" type="object" class="oe_highlight"/>
|
||||
</div>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
Reference in New Issue
Block a user