onchange_journal_id testing
bzr revid: psa@tinyerp.com-20130918104720-5btsto01o6w9uumo
This commit is contained in:
parent
b855aada49
commit
c5814d3e6f
|
@ -128,7 +128,7 @@ class account_bank_statement(osv.osv):
|
|||
'currency': fields.function(_currency, string='Currency',
|
||||
type='many2one', relation='res.currency'),
|
||||
'account_id': fields.related('journal_id', 'default_debit_account_id', type='many2one', relation='account.account', string='Account used in this journal', readonly=True, help='used in statement reconciliation domain, but shouldn\'t be used elswhere.'),
|
||||
'cash_control': fields.related('journal_id', 'cash_control' , type='boolean', relation='account.journal',string='Cash control', store=True),
|
||||
'cash_control': fields.related('journal_id', 'cash_control' , type='boolean', relation='account.journal',string='Cash control'),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
|
@ -461,12 +461,16 @@ class account_bank_statement(osv.osv):
|
|||
def onchange_journal_id(self, cr, uid, statement_id, journal_id, context=None):
|
||||
if not journal_id:
|
||||
return {}
|
||||
if context is None:
|
||||
context = {}
|
||||
res = {}
|
||||
balance_start = self._compute_balance_end_real(cr, uid, journal_id, context=context)
|
||||
res['balance_start'] = balance_start
|
||||
journal = self.pool.get('account.journal').browse(cr, uid, journal_id, context=context)
|
||||
res['company_id'] = journal.company_id.id
|
||||
currency = journal.currency or journal.company_id.currency_id
|
||||
return {'value': {'balance_start': balance_start, 'company_id': journal.company_id.id, 'currency': currency.id, 'cash_control': journal.cash_control}}
|
||||
res['currency'] = currency.id
|
||||
if journal.type == 'cash':
|
||||
res['cash_control'] = journal.cash_control
|
||||
return {'value': res}
|
||||
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
stat = self.read(cr, uid, ids, ['state'], context=context)
|
||||
|
|
Loading…
Reference in New Issue