account: remove exception when opening an partner when there is no fiscal year
bzr revid: ced-48f0a959e87039954ddf0ab89bc845e9f847e1cc
This commit is contained in:
parent
db2f97058a
commit
dbfc918f1d
|
@ -453,12 +453,15 @@ class account_fiscalyear(osv.osv):
|
|||
ds = ds + RelativeDateTime(months=interval)
|
||||
return True
|
||||
|
||||
def find(self, cr, uid, dt=None, context={}):
|
||||
def find(self, cr, uid, dt=None, exception=True, context={}):
|
||||
if not dt:
|
||||
dt = time.strftime('%Y-%m-%d')
|
||||
ids = self.search(cr, uid, [('date_start', '<=', dt), ('date_stop', '>=', dt)])
|
||||
if not ids:
|
||||
raise osv.except_osv('Error !', 'No fiscal year defined for this date !\nPlease create one.')
|
||||
if exception:
|
||||
raise osv.except_osv('Error !', 'No fiscal year defined for this date !\nPlease create one.')
|
||||
else:
|
||||
return False
|
||||
return ids[0]
|
||||
account_fiscalyear()
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class account_move_line(osv.osv):
|
|||
|
||||
def _query_get(self, cr, uid, obj='l', context={}):
|
||||
if not 'fiscalyear' in context:
|
||||
context['fiscalyear'] = self.pool.get('account.fiscalyear').find(cr, uid)
|
||||
context['fiscalyear'] = self.pool.get('account.fiscalyear').find(cr, uid, exception=False)
|
||||
return "l.active AND l.state<>'draft' AND l.period_id in (SELECT id from account_period WHERE fiscalyear_id=%d)" % (context['fiscalyear'] ,)
|
||||
|
||||
def default_get(self, cr, uid, fields, context={}):
|
||||
|
|
Loading…
Reference in New Issue