[IMP] point_of_sale: If there is no journals for the pos.config, select the cash journals

bzr revid: stw@openerp.com-20120910091618-nzv26m258xx64na5
This commit is contained in:
Stephane Wirtel 2012-09-10 11:16:18 +02:00
parent 8376f3a237
commit 7c9b5c8e5b
1 changed files with 2 additions and 3 deletions

View File

@ -314,10 +314,9 @@ class pos_session(osv.osv):
# define some cash journal if no payment method exists
if not pos_config.journal_ids:
cashids = self.pool.get('account.journal').search(cr, uid, [('journal_user','=',True)], context=context)
cashids = self.pool.get('account.journal').search(cr, uid, [('journal_user', '=', True), ('type','=','cash')], context=context)
if not cashids:
cashids = self.pool.get('account.journal').search(cr, uid, [('type','=','cash')], context=context)
self.pool.get('account.journal').write(cr, uid, cashids, {'journal_user': True})
cashids = self.pool.get('account.journal').search(cr, uid, [('journal_user','=',True)], context=context)
jobj.write(cr, uid, [pos_config.id], {'journal_ids': [(6,0, cashids)]})