[IMP]Improved code to open form view of followup level

bzr revid: cod@tinyerp.com-20140313124645-tdbawyh2tbfsw5ho
This commit is contained in:
Chirag Dodiya (OpenERP) 2014-03-13 18:16:45 +05:30
parent f7c0288478
commit a06919ccc7
1 changed files with 8 additions and 7 deletions

View File

@ -485,13 +485,14 @@ class account_config_settings(osv.osv_memory):
_inherit = 'account.config.settings'
def open_followup_level_form(self, cr, uid, ids, context=None):
ir_model_obj = self.pool.get('ir.model.data')
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',
}
model, action_id = ir_model_obj.get_object_reference(cr, uid, 'account_followup', 'action_account_followup_definition_form')
action = self.pool.get(model).read(cr, uid, action_id, context=context)
if res_ids:
action['res_id'] = res_ids[0]
action['views'] = [(False, u'form'), (False, u'tree')]
return action
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: