diff --git a/addons/account/account.py b/addons/account/account.py index 910f4b4c6ff..c165a7f3b42 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1652,7 +1652,7 @@ class account_move_reconcile(osv.osv): 'create_date': fields.date('Creation date', readonly=True), } _defaults = { - 'name': lambda self,cr,uid,ctx={}: self.pool.get('ir.sequence').get(cr, uid, 'account.reconcile') or '/', + 'name': lambda self,cr,uid,ctx=None: self.pool.get('ir.sequence').get(cr, uid, 'account.reconcile', context=ctx) or '/', } def reconcile_partial_check(self, cr, uid, ids, type='auto', context=None): diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 6a2bf7ff0ea..adc131efce2 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -341,11 +341,11 @@ class account_bank_statement(osv.osv): if not st.name == '/': st_number = st.name else: + c = {'fiscalyear_id': st.period_id.fiscalyear_id.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) else: - st_number = obj_seq.next_by_code(cr, uid, 'account.bank.statement') + st_number = obj_seq.next_by_code(cr, uid, 'account.bank.statement', context=c) for line in st.move_line_ids: if line.state <> 'valid': diff --git a/addons/account/account_cash_statement.py b/addons/account/account_cash_statement.py index 226e78ccef6..567af74b59c 100644 --- a/addons/account/account_cash_statement.py +++ b/addons/account/account_cash_statement.py @@ -292,11 +292,11 @@ 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))) if statement.name and statement.name == '/': + c = {'fiscalyear_id': statement.period_id.fiscalyear_id.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) else: - st_number = obj_seq.next_by_code(cr, uid, 'account.cash.statement') + st_number = obj_seq.next_by_code(cr, uid, 'account.cash.statement', context=c) vals.update({ 'name': st_number }) diff --git a/addons/account/ir_sequence.py b/addons/account/ir_sequence.py index 5c9039e43c3..a98b7e87d77 100644 --- a/addons/account/ir_sequence.py +++ b/addons/account/ir_sequence.py @@ -48,6 +48,8 @@ class ir_sequence(osv.osv): } 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 line in seq.fiscal_ids: if line.fiscalyear_id.id == context.get('fiscalyear_id'): diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 8cb22ade87c..40d6c40c257 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -889,7 +889,7 @@ class account_voucher(osv.osv): if voucher_brw.number: name = voucher_brw.number elif voucher_brw.journal_id.sequence_id: - name = seq_obj.next_by_id(cr, uid, voucher_brw.journal_id.sequence_id.id) + name = seq_obj.next_by_id(cr, uid, voucher_brw.journal_id.sequence_id.id, context=context) else: raise osv.except_osv(_('Error !'), _('Please define a sequence on the journal !')) diff --git a/addons/point_of_sale/wizard/pos_open_statement.py b/addons/point_of_sale/wizard/pos_open_statement.py index 11bc8b33558..31e35d3fa10 100644 --- a/addons/point_of_sale/wizard/pos_open_statement.py +++ b/addons/point_of_sale/wizard/pos_open_statement.py @@ -52,9 +52,9 @@ class pos_open_statement(osv.osv_memory): ids = statement_obj.search(cr, uid, [('state', '!=', 'confirm'), ('user_id', '=', uid), ('journal_id', '=', journal.id)], context=context) if journal.sequence_id: - number = sequence_obj.next_by_id(cr, uid, journal.sequence_id.id) + number = sequence_obj.next_by_id(cr, uid, journal.sequence_id.id, context=context) else: - number = sequence_obj.next_by_code(cr, uid, 'account.cash.statement') + number = sequence_obj.next_by_code(cr, uid, 'account.cash.statement', context=context) data.update({ 'journal_id': journal.id,