[IMP] clean-up fp

bzr revid: jco@openerp.com-20121121144932-fmsldkrtngb097r8
This commit is contained in:
Josse Colpaert 2012-11-21 15:49:32 +01:00
parent 4285d43930
commit 7dbe9bc58a
7 changed files with 291 additions and 411 deletions

View File

@ -32,23 +32,23 @@ class followup(osv.osv):
_description = 'Account Follow-up'
_rec_name = 'name'
_columns = {
#'name': fields.char('Name', size=64, required=True),
#'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', required=True),
'company_id': fields.many2one('res.company', 'Company', required=True),
'name': fields.related('company_id', 'name', string = "Name"),
}
_defaults = {
'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'account_followup.followup', context=c),
}
_sql_constraints = [('company_uniq', 'unique(company_id)', 'Only one follow-up per company is allowed')]
followup()
class followup_line(osv.osv):
class followup_line(osv.osv):
def _get_default_template(self, cr, uid, ids, context=None):
dummy, templ = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account_followup', 'email_template_account_followup_default')
return templ
@ -56,18 +56,17 @@ class followup_line(osv.osv):
_name = 'account_followup.followup.line'
_description = 'Follow-up Criteria'
_columns = {
'name': fields.char('Name', size=64, required=True),
'name': fields.char('Follow-Up Action', size=64, required=True),
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of follow-up lines."),
'delay': fields.integer('Due Days', help="The number of days after the due date of the invoice to wait before sending the reminder. Could be negative if you want to send a polite alert beforehand."),
#'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),
'send_email':fields.boolean('Send Email', help="When processing, it will send an email"),
'send_letter':fields.boolean('Send Letter', help="When processing, it will print a letter"),
'send_email':fields.boolean('Send an Email', help="When processing, it will send an email"),
'send_letter':fields.boolean('Send a Letter', help="When processing, it will print a letter"),
'manual_action':fields.boolean('Manual Action', help="When processing, it will set the manual action to be taken for that customer. "),
'manual_action_note':fields.text('Action Text', placeholder="e.g. Give a phone call, check with others , ..."),
'manual_action_responsible_id':fields.many2one('res.users', 'Responsible', ondelete='set null'),
'email_template_id':fields.many2one('email.template', 'Email Template', ondelete='set null'),
'manual_action_note':fields.text('Action To Do', placeholder="e.g. Give a phone call, check with others , ..."),
'manual_action_responsible_id':fields.many2one('res.users', 'Assign a Responsible', ondelete='set null'),
'email_template_id':fields.many2one('email.template', 'Email Template', ondelete='set null'),
'email_body':fields.related('email_template_id', 'body_html', type='text', string="Email Message", relation="email.template", translate="True"),
}
_order = 'delay'
@ -75,7 +74,7 @@ class followup_line(osv.osv):
_defaults = {
'send_email': True,
'send_letter': False,
'manual_action':False,
'manual_action':False,
'description': """
Dear %(partner_name)s,
@ -87,22 +86,22 @@ Best Regards,
""",
'email_template_id': _get_default_template,
}
def on_change_template(self, cr, uid, ids, template_id, context=None):
#result = {}
values = {}
if template_id:
template = self.pool.get('email.template').browse(cr, uid, template_id, context=context)
values = {
'email_body':template.body_html,
'email_body':template.body_html,
}
return {'value': values}
def _check_description(self, cr, uid, ids, context=None):
for line in self.browse(cr, uid, ids, context=context):
if line.description:
@ -119,19 +118,19 @@ Best Regards,
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):
for aml in self.browse(cr, uid, ids, context):
res[aml.id] = aml.debit - aml.credit
return res
_inherit = 'account.move.line'
_columns = {
'followup_line_id': fields.many2one('account_followup.followup.line', 'Follow-up Level', ondelete='restrict'), #restrict deletion of the followup line
@ -147,7 +146,7 @@ account_move_line()
class email_template(osv.osv):
_inherit = 'email.template'
#Adds current_date to the context. That way it can be used in the email templates
#TODO: need information
def render_template(self, cr, uid, template, model, res_id, context=None):
@ -162,28 +161,29 @@ 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,
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 view_type == 'form' and context and 'Followupfirst' in context.keys() and context['Followupfirst'] == True:
doc = etree.XML(res['arch'], parser=None, base_url=None)
first_node = doc.xpath("//page[@string='Payments Follow-up']")
#first_node[0].getparent().append(first_node[0])
root = first_node[0].getparent()
first_node = doc.xpath("//page[@string='Payments Follow-up']")
#first_node[0].getparent().append(first_node[0])
root = first_node[0].getparent()
root.insert(0, first_node[0])
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
# 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
# return res
#
#
#TODO: refactor these functions: remove this one, rework _get_latest and _get_newt_followup_level_id must call _get_latest
def _get_latest_followup_level_id(self, cr, uid, ids, name, arg, context=None):
res = {}
for partner in self.browse(cr, uid, ids, context):
@ -195,8 +195,8 @@ class res_partner(osv.osv):
res[partner.id] = accountmoveline.followup_line_id.id
#res[partner.id] = max(x.followup_line_id.delay for x in amls) if len(amls) else False
return res
def _get_latest(self, cr, uid, ids, names, arg, context=None):
res={}
for partner in self.browse(cr, uid, ids, context):
@ -206,15 +206,15 @@ class res_partner(osv.osv):
latest_level_without_lit = False
latest_days = False
latest_days_without_lit = False
for aml in amls:
for aml in amls:
#Give initial value
if latest_date == False:
latest_date = aml.followup_date
if aml.followup_line_id:
latest_level = aml.followup_line_id.id
if aml.followup_line_id:
latest_level = aml.followup_line_id.id
latest_days = aml.followup_line_id.delay
if not aml.blocked and latest_level_without_lit == False and aml.followup_line_id:
latest_level_without_lit = aml.followup_line_id.id
if not aml.blocked and latest_level_without_lit == False and aml.followup_line_id:
latest_level_without_lit = aml.followup_line_id.id
latest_days_without_lit = aml.followup_line_id.delay
#If initial value < ...
if latest_date and latest_level:
@ -224,10 +224,10 @@ class res_partner(osv.osv):
latest_days = aml.followup_line_id.delay
latest_level = aml.followup_line_id.id
if not aml.blocked and latest_level_without_lit and aml.followup_line_id and aml.followup_line_id.delay > latest_days_without_lit:
latest_days_without_lit = aml.followup_line_id.delay
latest_days_without_lit = aml.followup_line_id.delay
latest_level_without_lit = aml.followup_line_id.id
res[partner.id] = {'latest_followup_date': latest_date,
'latest_followup_level_id': latest_level,
'latest_followup_level_id': latest_level,
'latest_followup_level_id_without_lit': latest_level_without_lit}
return res
@ -244,10 +244,10 @@ class res_partner(osv.osv):
if latest: #if latest exists
newlevel = latest.id
old_delay = latest.delay
fl_ar = self.pool.get('account_followup.followup.line').search(cr, uid, [('followup_id.company_id.id','=', partner.company_id.id)])
fl_ar = self.pool.get('account_followup.followup.line').search(cr, uid, [('followup_id.company_id.id','=', partner.company_id.id)])
for fl_obj in self.pool.get('account_followup.followup.line').browse(cr, uid, fl_ar):
if not old_delay:
if not delay or fl_obj.delay < delay:
if not old_delay:
if not delay or fl_obj.delay < delay:
delay = fl_obj.delay
newlevel = fl_obj.id
else:
@ -264,17 +264,21 @@ class res_partner(osv.osv):
# print "get amount overdue"
# for partner in self.browse(cr, uid, ids, context):
# res[partner.id] = 0.0
# for aml in partner.accountmoveline_ids:
# for aml in partner.accountmoveline_ids:
# res[partner.id] = res[partner.id] + aml.debit - aml.credit #or by using function field
# return res
#
#TODO: remove
#
def _get_amount_due(self, cr, uid, ids, name, arg, context=None):
res = {}
for partner in self.browse(cr, uid, ids, context):
res[partner.id] = partner.credit
return res
#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 are res.partner ids #TODO: useless comment to remove
@ -283,7 +287,7 @@ class res_partner(osv.osv):
action_text= ""
#Check action
if partner.payment_next_action:
action_text = partner.payment_next_action + " + " + partner.latest_followup_level_id_without_lit.manual_action_note
action_text = (partner.payment_next_action or '') + "\n" + (partner.latest_followup_level_id_without_lit.manual_action_note or '')
else:
action_text = partner.latest_followup_level_id_without_lit.manual_action_note
#Check minimum date
@ -298,17 +302,16 @@ class res_partner(osv.osv):
responsible_id = partner.payment_responsible_id.id
else:
if partner.latest_followup_level_id_without_lit.manual_action_responsible_id:
responsible_id = partner.latest_followup_level_id_without_lit.manual_action_responsible_id.id
self.write(cr, uid, [partner.id], {'payment_next_action_date': action_date,
'payment_next_action': action_text,
responsible_id = partner.latest_followup_level_id_without_lit.manual_action_responsible_id.id
self.write(cr, uid, [partner.id], {'payment_next_action_date': action_date,
'payment_next_action': action_text,
'payment_responsible_id': responsible_id})
def do_partner_print(self, cr, uid, partner_ids, data, context=None):
#partner_ids are ids from special view, not from res.partner
#partner_ids are ids from special view, not from res.partner
#data.update({'date': context['date']})
if not partner_ids:
if not partner_ids:
return {}
data['partner_ids'] = partner_ids
datas = {
@ -317,9 +320,9 @@ class res_partner(osv.osv):
'form': data
}
return {
'type': 'ir.actions.report.xml',
'report_name': 'account_followup.followup.print',
'datas': datas,
'type': 'ir.actions.report.xml',
'report_name': 'account_followup.followup.print',
'datas': datas,
}
def do_partner_mail(self, cr, uid, partner_ids, context=None):
@ -330,7 +333,7 @@ class res_partner(osv.osv):
for partner in self.browse(cr, uid, partner_ids, context):
print "Email", partner.email
if partner.email != False and partner.email != '' and partner.email != ' ':
if partner.latest_followup_level_id_without_lit and partner.latest_followup_level_id_without_lit.send_email and partner.latest_followup_level_id_without_lit.email_template_id.id != False :
if partner.latest_followup_level_id_without_lit and partner.latest_followup_level_id_without_lit.send_email and partner.latest_followup_level_id_without_lit.email_template_id.id != False :
mtp.send_mail(cr, uid, partner.latest_followup_level_id_without_lit.email_template_id.id, partner.id, context=context)
else :
mail_template_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account_followup', 'email_template_account_followup_default')
@ -346,13 +349,13 @@ class res_partner(osv.osv):
payment_next_action = partner.payment_next_action + " + " + action_text
else:
payment_next_action = action_text
self.write(cr, uid, [partner.id], {'payment_next_action_date': payment_action_date,
self.write(cr, uid, [partner.id], {'payment_next_action_date': payment_action_date,
'payment_next_action': payment_next_action}, context)
return unknown_mails
def action_done(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'payment_next_action_date': False, 'payment_next_action':'', 'payment_responsible_id': False}, context)
def do_button_print(self, cr, uid, ids, context=None):
#TODO: assert that ids is a list of 1 element only before doing ids[0]
self.message_post(cr, uid, [ids[0]], body=_('Printed overdue payments report'), context=context)
@ -367,54 +370,27 @@ class res_partner(osv.osv):
'datas': datas,
'nodestroy' : True
}
def do_button_mail(self, cr, uid, ids, context=None):
self.do_partner_mail(cr, uid, ids, context)
def _get_aml_storeids(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.id not in partnerlist:
if aml.partner_id.id not in partnerlist:
partnerlist.append(aml.partner_id.id)
return partnerlist
#
# def _get_am_storeids(self, cr, uid, ids, context=None):
# partnerlist = []
# for am in self.pool.get("account.move").browse(cr, uid, ids, context):
# if am.partner_id.id not in partnerlist:
# partnerlist.append(am.partner_id.id)
# print am.partner_id.id
# return partnerlist
#
# def _get_rec_storeids(self, cr, uid, ids, context=None):
# partnerlist = []
# for rec in self.pool.get("account.move.reconcile").browse(cr, uid, ids, context):
# for am in self.pool.get("account.move.line").browse(cr, uid, [x.id for x in rec.line_partial_ids], context):
# if am.partner_id.id not in partnerlist:
# partnerlist.append(am.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
#
_inherit = "res.partner"
_columns = {
'payment_responsible_id':fields.many2one('res.users', ondelete='set null', string='Followup Responsible', help="Responsible for making sure the action happens."), #TODO find better name for field
#'payment_followup_level_id':fields.many2one('account_followup.followup.line', 'Followup line'),
'payment_note':fields.text('Payment Note', help="Payment Note"),
'payment_next_action':fields.char('Next Action', 50,
help="This is the next action to be taken by the user. It will automatically be set when the action fields are empty and the partner gets a follow-up level that requires a manual action. "), #Just an action #TODO: size=128
'payment_next_action_date':fields.date('Next Action Date',
'payment_note':fields.text('Customer Payment Promise', help="Payment Note"),
'payment_next_action':fields.text('Next Action',
help="This is the next action to be taken by the user. It will automatically be set when the action fields are empty and the partner gets a follow-up level that requires a manual action. "), #TODO: size=128
'payment_next_action_date':fields.date('Next Action Date',
help="This is when further follow-up is needed. The date will have been set to the current date if the action fields are empty and the partner gets a follow-up level that requires a manual action. "), # next action date
'accountmoveline_ids':fields.one2many('account.move.line', 'partner_id', domain=['&', ('reconcile_id', '=', False), '&',
('account_id.active','=', True), '&', ('account_id.type', '=', 'receivable'), ('state', '!=', 'draft')]), #TODO: find better name
@ -436,15 +412,9 @@ 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_due':fields.function(_get_amount_due, method=True, type='float', store=False), #TODO: use a fields.related
#'credit':fields.function(_get_amount_overdue, method=True, type='float', string="Amount Overdue",
# help="Amount Overdue: The amount the customer owns us",
# store={'account.move.line': (_get_aml_storeids, ['followup_line_id', 'followup_date', 'debit', 'credit', 'invoice', 'reconcile_partial_id'], 10),
# 'account.move': (_get_am_storeids, ['ref', 'name'], 10),
# #'account.move.reconcile': (_get_rec_storeids, ['name', 'type'], 10),
# },
# ),
}
}
res_partner()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,222 +1,160 @@
<openerp>
<data>
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- followup of customers views
-->
<!-- followup of customers views -->
<record id="customer_followup_tree" model="ir.ui.view">
<field name="name">ddd</field>
<field name="model">res.partner</field>
<!--<field name="type">tree</field>-->
<field name="priority" eval="20"/>
<field name="arch" type="xml">
<tree string="Customer Followup">
<field name="name"/>
<!--<field name="latest_followup_level_id"/>
<field name="latest_followup_date"/>-->
<field name="payment_next_action_date"/>
<field name="payment_next_action"/>
<!--Fields needed by inherited search view-->
<field name="user_id" invisible="1"/>
<field name="parent_id" invisible="1"/>
<!--<field name="payment_note"/>
<field name="phone"/>-->
<field name="credit"/>
<field name="payment_responsible_id"/>
<!--<field name="email"/>-->
<field name="latest_followup_level_id"/>
<field name="latest_followup_date"/>
</tree>
</field>
</record>
<record id="customer_followup_tree" model="ir.ui.view">
<field name="name">res.partner.followup.inherit.tree</field>
<field name="model">res.partner</field>
<field name="priority" eval="20"/>
<field name="arch" type="xml">
<tree string="Customer Followup">
<field name="name"/>
<field name="payment_next_action_date"/>
<field name="payment_next_action"/>
<field name="user_id" invisible="1"/>
<field name="parent_id" invisible="1"/>
<field name="credit"/>
<field name="payment_responsible_id"/>
<field name="latest_followup_level_id"/>
<field name="latest_followup_date"/>
</tree>
</field>
</record>
<record id="customer_followup_search_view" model="ir.ui.view">
<field name="name">Search</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_res_partner_filter"/>
<field name="arch" type="xml">
<search string="Search Partner" position="inside">
<group string="Follow-up">
<filter string="Partners with Credits" domain="[('credit', '>', 0.0)]" name="credits"/>
<separator/>
<filter string="Follow-ups to do" domain="[('payment_next_action_date', '&lt;=', time.strftime('%%Y-%%m-%%d'))]" name="todo"/>
<separator/>
<filter string="No Responsible" domain="[('payment_responsible_id', '=', False)]"/>
<filter string="My Follow-ups" domain="[('payment_responsible_id','=', uid)]"/>
</group>
<group expand="1" string="Group By...">
<filter string="Responsible" context="{'group_by':'payment_responsible_id'}"/>
</group>
</search>
</field>
</record>
<record id="customer_followup_search_view2" model="ir.ui.view">
<field name="name">Search</field>
<field name="model">res.partner</field>
<field name="arch" type="xml">
<search string="Search view">
<field name="name"/>
<field name="payment_next_action"/>
<!--<filter string="Actions to be taken with overdue amount" domain="['&amp;', ('payment_amount_outstanding', '>', 0.0), ('payment_next_action_date', '&lt;=', time.strftime('%%Y-%%m-%%d'))]"/>
<separator/>-->
<filter string="Overdue amount" domain="[('credit', '>', 0.0)]"/>
<separator/>
<filter string="Follow-ups to do" domain="[('payment_next_action_date', '&lt;=', time.strftime('%%Y-%%m-%%d'))]"/>
<separator/>
<!--filter string="Future follow-ups" domain="['&', ('payment_next_action', '!=', ''), ('payment_next_action_date', '>', time.strftime('%%Y-%%m-%%d'))]"/>-->
<separator/>
<filter string="Without responsible" domain="[('payment_responsible_id', '=', False)]"/>
<filter string="I am responsible" domain="[('payment_responsible_id','=', uid)]"/>
<group expand="1" string="Group by">
<filter string="Responsible" context="{'group_by':'payment_responsible_id'}"/>
</group>
</search>
</field>
</record>
<record id="customer_followup_search_view" model="ir.ui.view">
<field name="name">Search</field>
<field name="model">res.partner</field>
<field name="type">search</field>
<field name="inherits_id" ref="base.view_res_partner_filter"/>
<field name="arch" type="xml">
<search string="Search Partner" position="inside">
<field name="payment_next_action"/>
<!--<filter string="Actions to be taken with overdue amount" domain="['&amp;', ('payment_amount_outstanding', '>', 0.0), ('payment_next_action_date', '&lt;=', time.strftime('%%Y-%%m-%%d'))]"/>
<separator/>-->
<group string="Follow-up">
<filter string="Partners with Credits" domain="[('credit', '>', 0.0)]" name="credits"/>
<separator/>
<filter string="Follow-ups to do" domain="[('payment_next_action_date', '&lt;=', time.strftime('%%Y-%%m-%%d'))]" name="todo"/>
<separator/>
<!--<filter string="Future follow-ups" domain="['&', ('payment_next_action', '!=', ''), ('payment_next_action_date', '>', time.strftime('%%Y-%%m-%%d'))]"/>-->
<separator/>
<filter string="No Responsible" domain="[('payment_responsible_id', '=', False)]"/>
<filter string="My Follow-ups" domain="[('payment_responsible_id','=', uid)]"/>
</group>
<group expand="1" string="Group By...">
<filter string="Responsible" context="{'group_by':'payment_responsible_id'}"/>
</group>
</search>
</field>
</record>
<record id="customer_followup_search_view2" model="ir.ui.view">
<field name="name">Search</field>
<field name="model">res.partner</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search view">
<field name="name"/>
<field name="payment_next_action"/>
<!--<filter string="Actions to be taken with overdue amount" domain="['&amp;', ('payment_amount_outstanding', '>', 0.0), ('payment_next_action_date', '&lt;=', time.strftime('%%Y-%%m-%%d'))]"/>
<separator/>-->
<filter string="Overdue amount" domain="[('credit', '>', 0.0)]"/>
<separator/>
<filter string="Follow-ups to do" domain="[('payment_next_action_date', '&lt;=', time.strftime('%%Y-%%m-%%d'))]"/>
<separator/>
<!--filter string="Future follow-ups" domain="['&', ('payment_next_action', '!=', ''), ('payment_next_action_date', '>', time.strftime('%%Y-%%m-%%d'))]"/>-->
<separator/>
<filter string="Without responsible" domain="[('payment_responsible_id', '=', False)]"/>
<filter string="I am responsible" domain="[('payment_responsible_id','=', uid)]"/>
<group expand="1" string="Group by">
<filter string="Responsible" context="{'group_by':'payment_responsible_id'}"/>
</group>
</search>
</field>
</record>
<record id="action_customer_followup" model="ir.actions.act_window">
<field name="name">Customer Follow Up</field>
<field name="view_id" ref="customer_followup_tree"/>
<field name="res_model">res.partner</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="context">{} </field>
<!--<field name="domain">[('credit', '>', 0)]</field>--> <!--('customer', '=', True), ('latest_followup_date','!=', False)-->
<field name="context">{'Followupfirst':True, 'search_default_todo': True, 'search_default_credits': True} </field>
<field name="search_view_id" ref="customer_followup_search_view"/>
</record>
<record id="action_customer_followup" model="ir.actions.act_window">
<field name="name">Customer Follow Up</field>
<field name="view_id" ref="customer_followup_tree"/>
<field name="res_model">res.partner</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="context">{} </field>
<!--<field name="domain">[('credit', '>', 0)]</field>--> <!--('customer', '=', True), ('latest_followup_date','!=', False)-->
<field name="context">{'Followupfirst':True, 'search_default_todo': True, 'search_default_credits': True} </field>
<field name="search_view_id" ref="customer_followup_search_view"/>
</record>
<!--Inherited view -->
<!--Inherited view -->
<record id="view_partner_inherit_followup_form" model="ir.ui.view">
<record id="view_partner_inherit_followup_form" model="ir.ui.view">
<field name="name">res.partner.followup.form.inherit</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="model">res.partner</field>
<!--<field eval="[(4, ref('account.group_account_user'))]" name="groups_id"/>--><!-- or user? -->
<!--<field eval="[(4, ref('account.group_account_user'))]" name="groups_id"/>--><!-- or user? -->
<field name="arch" type="xml" >
<div name="buttons" position="inside">
<button name="do_button_print" type="object" string="Print Overdue Payments" groups="account.group_account_user" help="Print overdue payments report independent of follow-up line" attrs="{'invisible':[('credit', '&lt;=', 0.0)]}" />
<button name="do_button_mail" type="object" string="Send Overdue Email" groups="account.group_account_user" help="If not specified by the latest follow-up level, it will send from the default follow-up of overdue invoices template" attrs="{'invisible':[('credit', '&lt;=', 0.0)]}"/>
</div>
<page string="Accounting" position="before" version="7.0">
<page string="Payments Follow-up" position="inside" groups="account.group_account_invoice">
<div class = "oe_inline">
<p attrs="{'invisible':[('latest_followup_date','=', False)]}" class="oe_inline">The <field name="latest_followup_date" />, the latest level that was executed, was <field name="latest_followup_level_id" class="oe_inline"/>.
</p>
<!--<p class="oe_inline" attrs="{'invisible':[('credit', '&lt;=', 0.0)]}">The partner owns us <field name="credit" class="oe_inline"/>
</p>-->
<!--<p attrs="{'invisible':[('payment_next_action', '=', False)]}">This is the action required now:</p>-->
</div>
<p class="oe_inline">
<label for="payment_next_action" string="Next Follow-up Action"/>
<field name="payment_next_action_date" nolabel="1" class="oe_inline"/> <label string="-" attrs="{'invisible': ['|', ('payment_next_action_date', '=', False), ('payment_next_action', '=', False)]}"/>
<field name="payment_next_action" class="oe_inline" nolabel="1" string="Next Follow-up action" placeholder="e.g. Give a phonecall, Check if he paid, ..."/>
<span attrs="{'invisible':[('payment_responsible_id', '=', False)]}"> to be done by: </span> <field name="payment_responsible_id" placeholder="The user responsible for taking this action e.g. sales" class="oe_inline"/>
<span attrs="{'invisible':['|', ('payment_next_action_date', '!=', False), '|', ('payment_responsible_id', '!=', False), ('payment_next_action', '!=', False)]}">No action defined right now. </span>
<br/>
<button name="action_done" type="object" string="&#8627; Mark as Done"
help="This button will clear the action, the action date and the responsible. " class="oe_link"
attrs="{'invisible':['&amp;',('payment_next_action_date','=', False), '&amp;', ('payment_responsible_id','=', False), ('payment_next_action', '=', False)]}"
groups="res_security.group_partner_manager, account.group_account_user"/>
</p>
<!--attrs="{'invisible':['&amp;',('payment_next_action_date','=', False), '&amp;', ('payment_responsible_id','=', False), ('payment_next_action', '=', False)]}"-->
<group>
<field name="payment_note" string="The customer promised:"/>
</group>
<p class="oe_grey"> <!--maybe only when accountmovelines empty-->
Here is the history of the transactions of this customer. By clicking on the check box, you can put an invoice as litigation. This means you are still in discussion about it and it
will not be taken into account by the wizard.
</p>
<group>
<field name="accountmoveline_ids" nolabel="1" > <!--ontext="{'default_partner_id': active_id}" mode="kanban"-->
<tree string="Account Move line" editable="bottom" create="false" delete="false" colors="red:date_maturity and date_maturity&lt;current_date or date&lt;current_date">
<field name="date" readonly="True"/>
<field name="move_id" readonly="True"/>
<field name="blocked" string="Litigation"/>
<field name="date_maturity" readonly="True"/>
<field name="reconcile_partial_id" readonly="True"/>
<field name="result" readonly="True"/>
<field name="followup_line_id" invisible='1'/>
</tree>
<!-- <kanban default_group_by="followup_line_id" create="false">
<field name="followup_line_id"/>
<field name="result"/>
<field name="date_maturity"/>
<field name="blocked"/>
<field name="partner_id"/>
<field name="ref"/>
<field name="invoice"/>
<templates>
<t t-name="kanban-box">-->
<!--<a t-if="! read_only_mode" type="delete" style="position: absolute; right: 0; padding: 4px; diplay: inline-block">X</a>-->
<!--<div class="oe_module_vignette oe_semantic_html_override">
<h4><a type="open"><field name="ref"/></a></h4>
<a type="open"><field name="invoice"/></a>
<i><div t-if="record.result.raw_value">
<field name="result"/></div></i>
<div><a t-if="record.date_maturity.raw_value" title="Date">
<field name="date_maturity"/>
</a></div>
<a t-if="record.blocked.raw_value === true" type="object" string="Lit." name="set_kanban_state_litigation" class="oe_kanban_status oe_kanban_status_red"> </a>
<a t-if="record.blocked.raw_value === false" type="object" string="Lit." name="set_kanban_state_litigation" class="oe_kanban_status oe_kanban_status_green"></a>
<page string="Accounting" position="before" version="7.0">
<page string="Payments Follow-up" position="inside" groups="account.group_account_invoice">
<div class="oe_right oe_button_box" name="followup_button">
<button name="do_button_print" type="object" string="Print Overdue Payments" groups="account.group_account_user"
help="Print overdue payments report independent of follow-up line" attrs="{'invisible':[('credit', '&lt;=', 0.0)]}" />
<button name="do_button_mail" type="object" string="Send Overdue Email" groups="account.group_account_user"
help="If not specified by the latest follow-up level, it will send from the default follow-up of overdue invoices template" attrs="{'invisible':[('credit', '&lt;=', 0.0)]}"/>
</div>
</t>
</templates>
</kanban>-->
</field>
</group>
<p align="right"><B>Total amount: <field name="payment_amount_due" class="oe_inline"/> </B></p>
</page>
</page>
<p attrs="{'invisible':[('latest_followup_date','=', False)]}">
The <field name="latest_followup_date" class = "oe_inline"/>, the latest payment follow-up
was: <field name="latest_followup_level_id" class="oe_inline"/>.
</p>
<group>
<field name="payment_responsible_id" placeholder="Responsible of credit collection" class="oe_inline"/>
<label for="payment_next_action"/>
<div>
<field name="payment_next_action_date" class="oe_inline"/>
<button name="action_done" type="object" string="⇾ Mark as Done"
help="Click to mark the action as done." class="oe_link"
attrs="{'invisible':[('payment_next_action_date','=', False)]}"
groups="base.group_partner_manager"/>
<field name="payment_next_action" placeholder="e.g. Give a phonecall, Check if it's paid, ..."/>
</div>
</group>
<label for="payment_note" class="oe_edit_only"/>
<field name="payment_note" placeholder="e.g. 50%% before 15th of may, balance before 1st of july."/>
<p class="oe_grey"> <!--maybe only when accountmovelines empty-->
Here is the history of the transactions of this
customer. You can set an invoice in litigation in
order to not include it in the next payment
follow-ups.
</p>
<field name="accountmoveline_ids">
<tree string="Account Move line" editable="bottom" create="false" delete="false" colors="red:(not date_maturity or date_maturity&lt;=current_date) and result&gt;0">
<field name="date" readonly="True"/>
<field name="move_id" readonly="True"/>
<field name="blocked" string="Litigation"/>
<field name="date_maturity" readonly="True"/>
<field name="reconcile_partial_id" readonly="True"/>
<field name="result" readonly="True"/>
<field name="followup_line_id" invisible='1'/>
</tree>
</field>
<group class="oe_subtotal_footer oe_right">
<field name="payment_amount_due"/>
</group>
<div class="oe_clear"/>
</page>
</page>
</field>
</record>
<record id="action_view_customer_followup_form" model="ir.actions.act_window.view">
<field name="sequence" eval="2"/>
<field name="view_mode">form</field>
<field name="view_id" ref="view_partner_inherit_followup_form"/>
<field name="act_window_id" ref="action_customer_followup"/>
</record>
<record id="action_view_customer_followup_tree" model="ir.actions.act_window.view">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="customer_followup_tree"/>
<field name="act_window_id" ref="action_customer_followup"/>
</record>
<!-- Menus about followup of customers -->
<menuitem id="account_followup_s" action="action_customer_followup" parent="menu_finance_followup" name="Customers Requiring Action" sequence="3"/>
<record id="action_view_customer_followup_form" model="ir.actions.act_window.view">
<field name="sequence" eval="2"/>
<field name="view_mode">form</field>
<field name="view_id" ref="view_partner_inherit_followup_form"/>
<field name="act_window_id" ref="action_customer_followup"/>
</record>
<record id="action_view_customer_followup_tree" model="ir.actions.act_window.view">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="customer_followup_tree"/>
<field name="act_window_id" ref="action_customer_followup"/>
</record>
</data>
</openerp>
<!-- Menus about followup of customers -->
<menuitem id="account_followup_s" action="action_customer_followup" parent="menu_finance_followup" name="Do Manual Follow-Ups" sequence="3"/>
</data>
</openerp>

View File

@ -21,66 +21,48 @@
<field name="model">account_followup.followup.line</field>
<field name="arch" type="xml">
<form string="Follow-up Steps" version="7.0">
<h1><field name="name"/></h1>
<group>
<group>
<div class="oe_inline">
After <field name="delay" style="width: 15%%" nolabel="1"/> days, do the following actions:
</div>
</group>
<group>
<p class="oe_grey">
Manual actions can be followed up in the Customers Requiring Action report for
every customer and will only be set when the previous action has been marked as done,
which can be done in the Payments Follow-up tab of the Customer Form.
</p>
<!--<field name="start" style="width: 25%%"/>-->
</group>
</group>
<group>
<group>
<field name="manual_action"/>
<field name="send_letter"/>
<field name="send_email"/>
<label for="name" class="oe_edit_only"/>
<h1><field name="name"/></h1>
<div class="oe_inline">
After <field name="delay" class="oe_inline"/> days overdue, do the following actions:
</div>
<div>
<field name="manual_action" class="oe_inline"/>
<label for="manual_action"/>
</div><div>
<field name="send_email" class="oe_inline"/>
<label for="send_email"/>
</div><div>
<field name="send_letter" class="oe_inline"/>
<label for="send_letter"/>
</div>
<group string="Manual Action" attrs="{'invisible': [('manual_action', '=', False)]}">
<field name="manual_action_responsible_id"/>
<field name="manual_action_note" attrs="{'required': [('manual_action', '&lt;&gt;', False)]}"
placeholder="e.g. Call the customer, check if it's paid, ..."/>
</group>
<group>
<p class="oe_grey">
The format for the letters and emails can be specified. For the letters (PDF report),
the legend is specified below. For emails, we make use of an email template. Changing the text,
will change the text of the email template. Don't forget to translate them as the language of the partner
is used.
</p>
<group string="Send an Email" attrs="{'invisible': [('send_email', '=', False)]}">
<field name="email_template_id" attrs="{'required': [('send_email', '&lt;&gt;', False)]}"/>
</group>
<group string="Send a Letter" attrs="{'invisible': [('send_letter', '=', False)]}">
<p colspan="2" class="oe_grey">
Write here the introduction in the letter,
according to the level of the follow-up. You can
use the following keywords in the text. Don't
forget to translate in all languages you installed
using to top right icon.
<group class="oe_grey">
<b>%%(partner_name)s</b>: Partner Name
<b>%%(date)s</b>: Current Date
<b>%%(user_signature)s</b>: User Name
<b>%%(company_name)s</b>: User's Company Name
</group>
</p>
<field name="description" nolabel="1" colspan="2"/>
</group>
<group string="Manual Action" attrs="{'invisible': [('manual_action', '=', False)]}">
<field name="manual_action_note" string="Action to perform" attrs="{'invisible': [('manual_action', '=', False)]}" placeholder="e.g. Give a phonecall, Check if he paid, ..."/>
<field name="manual_action_responsible_id" attrs="{'invisible': [('manual_action', '=', False)]}"/>
</group>
<group col="2">
<group string="Send Letter" attrs="{'invisible': [('send_letter', '=', False)]}" colspan="2">
<field name="description" nolabel="1" colspan="2" />
<p>
<group>
<label string="%%(partner_name)s: Partner Name"/>
<label string="%%(date)s: Current Date"/>
<label string="%%(user_signature)s: User Name"/>
<label string="%%(company_name)s: User's Company Name"/>
</group>
</p>
</group>
<group string="Email" attrs="{'invisible': [('send_email', '=', False)]}" >
<field name="email_template_id" attrs="{'invisible': [('send_email', '=', False)]}" nolabel="1" on_change="on_change_template(email_template_id)"/>
<field name="email_body" attrs="{'invisible': [('send_email', '=', False)]}" colspan="2" nolabel="1"/>
</group>
</group>
</form>
</field>
</record>
@ -88,21 +70,18 @@
<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="group_ids" groups="base.group_multi_company"/>-->
<!-- <field name="group_ids" groups="base.group_multi_company"/>-->
<field name="arch" type="xml">
<form string="Follow-up" version="7.0">
<!-- <field name="name"/> -->
<h1><field name="company_id" widget="selection" class="oe_inline"/> Follow-up </h1><!--groups="base.group_multi_company"-->
<form string="Follow-up" version="7.0">
<h1><field name="company_id" widget="selection" class="oe_inline"/></h1>
<p class="oe_grey">
To remind our customers of paying their invoices,
we define different actions depending on how severely overdue the customer is. These actions are bundled
into folow-up levels that are triggered when the due date of the most overdue invoice has passed a
certain amount of days.
</p>
To remind our customers of paying their invoices, we
define different actions depending on how severely
overdue the customer is. These actions are bundled
into folow-up levels that are triggered when the due
date of the most overdue invoice has passed a certain
amount of days.
</p>
<field name="followup_line"/>
</form>
</field>
@ -126,7 +105,7 @@
<search string="Search Follow-up">
<!-- <field name="name" string="Follow-up"/> -->
<field name="company_id" groups="base.group_multi_company"/>
</search>
</field>
</record>
@ -141,14 +120,21 @@
<p class="oe_view_nocontent_create">
Click to define follow-up levels and their related actions.
</p><p>
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.
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.
</p>
</field>
</record>
<menuitem id="account.periodical_processing_reconciliation" groups="account.group_account_user" parent="menu_finance_followup" name="Reconciliation" sequence="1"/>
<menuitem
name="Reconcile Invoices &amp; Payments"
action="account.action_account_manual_reconcile"
parent="menu_finance_followup"
sequence="0"
id="menu_manual_reconcile_followup"/>
<menuitem action="action_account_followup_definition_form" id="account_followup_menu" parent="account.menu_finance_configuration" name="Follow-up Levels"/>
<report auto="False" id="account_followup_followup_report" menu="False" model="account_followup.followup" name="account_followup.followup.print" rml="account_followup/report/account_followup_print.rml" string="Follow-up Report"/>
@ -199,14 +185,5 @@
</field>
</record>
<act_window domain="[('reconcile_id', '=', False),('account_id.type','=','receivable')]" id="act_account_partner_account_move_all" name="Receivable Items" res_model="account.move.line" src_model="" view_id="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="Payable Items" res_model="account.move.line" src_model="" view_id="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"/> -->
</data>
</openerp>
</openerp>

View File

@ -64,8 +64,8 @@
<field name="context">{'search_default_followup_level':1}</field>
<field name="search_view_id" ref="view_account_followup_stat_search"/>
</record>
<menuitem id="menu_finance_followup" parent="account.menu_finance" name="Follow-up" groups="account.group_account_invoice"/>
<menuitem action="action_followup_stat" id="menu_action_followup_stat_follow" parent="menu_finance_followup" groups="account.group_account_invoice" name="Follow-ups Done Report" sequence="10"/>
<menuitem id="menu_finance_followup" parent="account.menu_finance" name="Follow-up" groups="account.group_account_invoice"/>
<menuitem action="action_followup_stat" id="menu_action_followup_stat_follow" parent="menu_finance_followup" groups="account.group_account_invoice" name="Follow-Ups Analysis" sequence="10"/>
</data>
</openerp>

View File

@ -22,9 +22,4 @@
I will process follow-ups
-
!python {model: account.followup.print}: |
self.do_process(cr, uid, [ref("account_followup_print_0")], {"active_ids": [ref("account_followup.account_followup_print_menu")], "active_id": ref("account_followup.account_followup_print_menu"),})
-
Unnecessary test of invoice
-
!assert {model: account.invoice, id: account.demo_invoice_0}:
- check_total == 14.0
self.do_process(cr, uid, [ref("account_followup_print_0")], {"active_ids": [ref("account_followup.account_followup_print_menu")], "active_id": ref("account_followup.account_followup_print_menu"),})

View File

@ -156,7 +156,7 @@ class account_followup_print(osv.osv_memory):
if partner.max_followup_id.manual_action:
partner_obj.do_partner_manual_action(cr, uid, [partner.partner_id.id], context)
nbmanuals = nbmanuals + 1
key = partner.partner_id.payment_responsible_id.name or "Empty"
key = partner.partner_id.payment_responsible_id.name or _("Nobody")
if not key in manuals.keys():
manuals[key]= 1
else:

View File

@ -281,7 +281,7 @@ class mail_message(osv.Model):
return {'id': message.id,
'type': message.type,
'body': html_email_clean(message.body),
'body': html_email_clean(message.body or ''),
'model': message.model,
'res_id': message.res_id,
'record_name': message.record_name,