[IMP] widget html, payment follow-up, view changes before rebase code qdp

bzr revid: jco@openerp.com-20121122092219-ebkgl0afgmori9hd
This commit is contained in:
Josse Colpaert
2012-11-22 10:22:19 +01:00
parent 7dbe9bc58a
commit 1a38725f86
7 changed files with 17 additions and 41 deletions
+1 -1
View File
@@ -20,7 +20,7 @@
##############################################################################
{
'name': 'Follow-up Management',
'name': 'Payment Follow-up Management',
'version': '1.0',
'category': 'Accounting & Finance',
'description': """
@@ -67,7 +67,6 @@ class followup_line(osv.osv):
'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'
_sql_constraints = [('days_uniq', 'unique(followup_id, delay)', 'Days of the follow-up levels must be different')] #TODO: ADD FOR multi-company!
@@ -90,18 +89,6 @@ Best Regards,
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,
}
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:
@@ -163,7 +150,6 @@ class res_partner(osv.osv):
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)
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']")
@@ -15,10 +15,8 @@
<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"/>
<field name="credit"/>
</tree>
</field>
</record>
@@ -32,7 +30,7 @@
<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"/>
<filter string="Follow-ups To Do" domain="[('payment_next_action_date', '&lt;=', time.strftime('%%Y-%%m-%%d')), ('credit', '>', 0.0)]" name="todo"/>
<separator/>
<filter string="No Responsible" domain="[('payment_responsible_id', '=', False)]"/>
<filter string="My Follow-ups" domain="[('payment_responsible_id','=', uid)]"/>
@@ -76,7 +74,7 @@
<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="context">{'Followupfirst':True, 'search_default_todo': True} </field>
<field name="search_view_id" ref="customer_followup_search_view"/>
</record>
@@ -115,7 +113,7 @@
<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
Below 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.
@@ -11,7 +11,6 @@
<field name="send_email"/>
<field name="send_letter"/>
<field name="manual_action"/>
<!--<field name="start"/>-->
</tree>
</field>
</record>
@@ -92,20 +91,17 @@
<field name="model">account_followup.followup</field>
<field name="arch" type="xml">
<tree string="Follow-up">
<!--<field name="name"/>-->
<field name="company_id" /> <!--groups="base.group_multi_company"-->
</tree>
</field>
</record>
</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="arch" type="xml">
<search string="Search Follow-up">
<!-- <field name="name" string="Follow-up"/> -->
<field name="company_id" groups="base.group_multi_company"/>
</search>
</field>
</record>
@@ -64,7 +64,7 @@
<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 id="menu_finance_followup" parent="account.menu_finance" name="Payment 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>
@@ -139,7 +139,7 @@ class account_followup_print(osv.osv_memory):
@@ -153,7 +153,7 @@ class account_followup_print(osv.osv_memory):
nbprints = 0
resulttext = " "
for partner in self.pool.get('account_followup.stat.by.partner').browse(cr, uid, partner_ids, context=context):
if partner.max_followup_id.manual_action:
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 _("Nobody")
@@ -167,13 +167,15 @@ class account_followup_print(osv.osv_memory):
if partner.max_followup_id.send_letter:
partner_ids_to_print.append(partner.id)
nbprints += 1
partner_obj.message_post(cr, uid, [partner.partner_id.id], body=_("Follow-up letter will be sent"), context=context)
partner_obj.message_post(cr, uid, [partner.partner_id.id], body=_("Follow-up letter will be sent from follow_up <I>") + partner.partner_id.latest_followup_level_id.name, context=context) + "</I>"
resulttext = resulttext + str(nbmails) + " emails sent (" + str(nbunknownmails) + " with unknown email) \n " + str(nbprints) + " letters in report \n " + str(nbmanuals) + " total manual action(s) assigned: \n \n"
needprinting = False
if nbprints > 0:
needprinting = True
for item in manuals:
resulttext = resulttext + item + ":" + str(manuals[item]) + "\n"
resulttext += "<ul>"
for item in manuals:
resulttext = resulttext + "<li>" + item + ":" + str(manuals[item]) + "\n </li>"
resulttext += "</ul>"
result = {}
action = partner_obj.do_partner_print(cr, uid, partner_ids_to_print, data, context)
result['needprinting'] = needprinting
@@ -214,9 +216,6 @@ class account_followup_print(osv.osv_memory):
'type': 'ir.actions.act_window',
'target': 'new',
}
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
@@ -267,7 +266,7 @@ 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': -> fait rien du tout
#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")
@@ -280,10 +279,8 @@ class account_followup_print(osv.osv_memory):
#Fill dictionary of accountmovelines to_update with the partners that need to be updated
for partner_id, followup_line_id, date_maturity,date, id in move_lines:
if not partner_id:
continue
if followup_line_id not in fups:
continue
stat_line_id = partner_id * 10000 + company_id
@@ -297,7 +294,6 @@ class account_followup_print(osv.osv_memory):
partner_list.append(stat_line_id)
to_update[str(id)]= {'level': fups[followup_line_id][1], 'partner_id': stat_line_id}
return {'partner_ids': partner_list, 'to_update': to_update}
account_followup_print()
@@ -76,12 +76,12 @@
<field name="arch" type="xml">
<form string="Summary of actions" version="7.0">
<header>
<field name="description" readonly="True" />
<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 report here" type="object" class="oe_highlight"/>
<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"/>