[FIX] account: bank statement fiscal year sequence
When using sequences per fiscal year, the sequence used to build the bank statement name must be the according fiscal year sequence. opw-671937 Closes #11185
This commit is contained in:
parent
df212977b8
commit
0977bd9798
|
@ -32,7 +32,7 @@ class account_bank_statement(osv.osv):
|
|||
def create(self, cr, uid, vals, context=None):
|
||||
if vals.get('name', '/') == '/':
|
||||
journal_id = vals.get('journal_id', self._default_journal_id(cr, uid, context=context))
|
||||
vals['name'] = self._compute_default_statement_name(cr, uid, journal_id, context=context)
|
||||
vals['name'] = self._compute_default_statement_name(cr, uid, journal_id, context=dict(context, period_id=vals.get('period_id')))
|
||||
if 'line_ids' in vals:
|
||||
for idx, line in enumerate(vals['line_ids']):
|
||||
line[2]['sequence'] = idx + 1
|
||||
|
@ -75,7 +75,7 @@ class account_bank_statement(osv.osv):
|
|||
def _compute_default_statement_name(self, cr, uid, journal_id, context=None):
|
||||
context = dict(context or {})
|
||||
obj_seq = self.pool.get('ir.sequence')
|
||||
period = self.pool.get('account.period').browse(cr, uid, self._get_period(cr, uid, context=context), context=context)
|
||||
period = self.pool.get('account.period').browse(cr, uid, context.get('period_id') or self._get_period(cr, uid, context=context), context=context)
|
||||
context['fiscalyear_id'] = period.fiscalyear_id.id
|
||||
journal = self.pool.get('account.journal').browse(cr, uid, journal_id, None)
|
||||
return obj_seq.next_by_id(cr, uid, journal.sequence_id.id, context=context)
|
||||
|
|
Loading…
Reference in New Issue