[IMP]set pos company in statment create

bzr revid: sgo@tinyerp.com-20121018125506-lrdsyklk0oap2u5z
This commit is contained in:
Sanjay Gohel (Open ERP) 2012-10-18 18:25:06 +05:30
parent 6696825b5e
commit f30d1585e5
2 changed files with 5 additions and 1 deletions

View File

@ -61,7 +61,7 @@ class account_bank_statement(osv.osv):
return res
def _get_period(self, cr, uid, context=None):
periods = self.pool.get('account.period').find(cr, uid)
periods = self.pool.get('account.period').find(cr, uid,context=context)
if periods:
return periods[0]
return False

View File

@ -296,6 +296,8 @@ class pos_session(osv.osv):
]
def create(self, cr, uid, values, context=None):
if context is None:
context = {}
config_id = values.get('config_id', False) or False
if config_id:
# journal_id is not required on the pos_config because it does not
@ -304,6 +306,7 @@ class pos_session(osv.osv):
# the .xml files as the CoA is not yet installed.
jobj = self.pool.get('pos.config')
pos_config = jobj.browse(cr, uid, config_id, context=context)
context.update({'company_id': pos_config.shop_id.company_id.id})
if not pos_config.journal_id:
jid = jobj.default_get(cr, uid, ['journal_id'], context=context)['journal_id']
if jid:
@ -330,6 +333,7 @@ class pos_session(osv.osv):
bank_values = {
'journal_id' : journal.id,
'user_id' : uid,
'company_id' : pos_config.shop_id.company_id.id
}
statement_id = self.pool.get('account.bank.statement').create(cr, uid, bank_values, context=context)
bank_statement_ids.append(statement_id)