[FIX] Reference to undefined context variable
[ADD] Check on 'None' context in account module's sequence override bzr revid: stefan@therp.nl-20120322113959-79wxzej9ih4igg28
This commit is contained in:
parent
94896a9c0b
commit
e792a85858
|
@ -341,8 +341,8 @@ class account_bank_statement(osv.osv):
|
||||||
if not st.name == '/':
|
if not st.name == '/':
|
||||||
st_number = st.name
|
st_number = st.name
|
||||||
else:
|
else:
|
||||||
|
c = {'fiscalyear_id': st.period_id.fiscalyear_id.id}
|
||||||
if st.journal_id.sequence_id:
|
if st.journal_id.sequence_id:
|
||||||
c = {'fiscalyear_id': st.period_id.fiscalyear_id.id}
|
|
||||||
st_number = obj_seq.next_by_id(cr, uid, st.journal_id.sequence_id.id, context=c)
|
st_number = obj_seq.next_by_id(cr, uid, st.journal_id.sequence_id.id, context=c)
|
||||||
else:
|
else:
|
||||||
st_number = obj_seq.next_by_code(cr, uid, 'account.bank.statement', context=c)
|
st_number = obj_seq.next_by_code(cr, uid, 'account.bank.statement', context=c)
|
||||||
|
|
|
@ -292,8 +292,8 @@ class account_cash_statement(osv.osv):
|
||||||
raise osv.except_osv(_('Error !'), (_('User %s does not have rights to access %s journal !') % (statement.user_id.name, statement.journal_id.name)))
|
raise osv.except_osv(_('Error !'), (_('User %s does not have rights to access %s journal !') % (statement.user_id.name, statement.journal_id.name)))
|
||||||
|
|
||||||
if statement.name and statement.name == '/':
|
if statement.name and statement.name == '/':
|
||||||
|
c = {'fiscalyear_id': statement.period_id.fiscalyear_id.id}
|
||||||
if statement.journal_id.sequence_id:
|
if statement.journal_id.sequence_id:
|
||||||
c = {'fiscalyear_id': statement.period_id.fiscalyear_id.id}
|
|
||||||
st_number = obj_seq.next_by_id(cr, uid, statement.journal_id.sequence_id.id, context=c)
|
st_number = obj_seq.next_by_id(cr, uid, statement.journal_id.sequence_id.id, context=c)
|
||||||
else:
|
else:
|
||||||
st_number = obj_seq.next_by_code(cr, uid, 'account.cash.statement', context=c)
|
st_number = obj_seq.next_by_code(cr, uid, 'account.cash.statement', context=c)
|
||||||
|
|
|
@ -48,6 +48,8 @@ class ir_sequence(osv.osv):
|
||||||
}
|
}
|
||||||
|
|
||||||
def _next(self, cr, uid, seq_ids, context=None):
|
def _next(self, cr, uid, seq_ids, context=None):
|
||||||
|
if context is None:
|
||||||
|
context = {}
|
||||||
for seq in self.browse(cr, uid, seq_ids, context):
|
for seq in self.browse(cr, uid, seq_ids, context):
|
||||||
for line in seq.fiscal_ids:
|
for line in seq.fiscal_ids:
|
||||||
if line.fiscalyear_id.id == context.get('fiscalyear_id'):
|
if line.fiscalyear_id.id == context.get('fiscalyear_id'):
|
||||||
|
|
Loading…
Reference in New Issue