[IMP] account: when the period is not defined, raise a RedirectWarning instead of a simple warning.
This allows to add a redirection button to the configuration panel of fiscal years. bzr revid: tde@openerp.com-20140103093610-p7u12yb03rkj81bk
This commit is contained in:
parent
4305522776
commit
6389c33cd6
|
@ -1023,7 +1023,10 @@ class account_period(osv.osv):
|
|||
if not result:
|
||||
result = self.search(cr, uid, args, context=context)
|
||||
if not result:
|
||||
raise osv.except_osv(_('Error!'), _('There is no period defined for this date: %s.\nPlease create one.')%dt)
|
||||
model, action_id = self.pool['ir.model.data'].get_object_reference(cr, uid, 'account', 'action_account_fiscalyear')
|
||||
msg = _('There is no period defined for this date: %s.\nPlease, go to Configuration/Periods and configure a fiscal year.') % dt
|
||||
raise openerp.exceptions.RedirectWarning(msg, action_id, _('Go to the configuration panel'))
|
||||
|
||||
return result
|
||||
|
||||
def action_draft(self, cr, uid, ids, *args):
|
||||
|
|
Loading…
Reference in New Issue