[IMP]Improved view of followup level and set method on link to open form view of followup level

bzr revid: cod@tinyerp.com-20140313112625-jaqka8ezgcn0exs6
This commit is contained in:
Chirag Dodiya (OpenERP) 2014-03-13 16:56:25 +05:30
parent 89df55eec1
commit f7c0288478
3 changed files with 20 additions and 7 deletions

View File

@ -31,7 +31,7 @@ class followup(osv.osv):
_columns = { _columns = {
'followup_line': fields.one2many('account_followup.followup.line', 'followup_id', 'Follow-up'), '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"), 'name': fields.related('company_id', 'name', string = "Name", readonly=True, type="char"),
} }
_defaults = { _defaults = {
'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'account_followup.followup', context=c), 'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'account_followup.followup', context=c),
@ -480,5 +480,18 @@ class res_partner(osv.osv):
multi="followup", multi="followup",
fnct_search=_payment_earliest_date_search), fnct_search=_payment_earliest_date_search),
} }
class account_config_settings(osv.osv_memory):
_name = 'account.config.settings'
_inherit = 'account.config.settings'
def open_followup_level_form(self, cr, uid, ids, context=None):
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
res_ids = self.pool.get('account_followup.followup').search(cr, uid, [('company_id','=', user.company_id.id)])
return {
'type': 'ir.actions.act_window',
'name': 'Payment Follow-ups',
'res_model': 'account_followup.followup',
'res_id': res_ids and res_ids[0] or False,
'view_mode': 'form,tree',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -71,7 +71,9 @@
<field name="model">account_followup.followup</field> <field name="model">account_followup.followup</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Follow-up" version="7.0"> <form string="Follow-up" version="7.0">
<h1><field name="company_id" widget="selection" class="oe_inline"/></h1> <h1><field name="name"/></h1>
<label for="company_id" groups="base.group_multi_company"/>
<field name="company_id" widget="selection" class="oe_inline" groups="base.group_multi_company"/>
<p class="oe_grey"> <p class="oe_grey">
To remind customers of paying their invoices, you can To remind customers of paying their invoices, you can
define different actions depending on how severely define different actions depending on how severely
@ -113,6 +115,7 @@
<field name="res_model">account_followup.followup</field> <field name="res_model">account_followup.followup</field>
<field name="search_view_id" ref="view_account_followup_filter"/> <field name="search_view_id" ref="view_account_followup_filter"/>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="help" type="html"> <field name="help" type="html">
<p class="oe_view_nocontent_create"> <p class="oe_view_nocontent_create">
Click to define follow-up levels and their related actions. Click to define follow-up levels and their related actions.

View File

@ -1,4 +1,3 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<openerp> <openerp>
<data> <data>
@ -8,9 +7,7 @@
<field name="inherit_id" ref="account.view_account_config_settings"/> <field name="inherit_id" ref="account.view_account_config_settings"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//label[@for='module_account_followup']" position="after"> <xpath expr="//label[@for='module_account_followup']" position="after">
<button type="action" <button type="object" name="open_followup_level_form" string="Configure your follow-up levels" class="oe_link"/>
name="%(action_account_followup_definition_form)d"
string="Configure your follow-up levels" class="oe_link"/>
</xpath> </xpath>
</field> </field>
</record> </record>