diff --git a/addons/point_of_sale/wizard/pos_box_entries.py b/addons/point_of_sale/wizard/pos_box_entries.py index 941b4f3c2d7..f7349726033 100644 --- a/addons/point_of_sale/wizard/pos_box_entries.py +++ b/addons/point_of_sale/wizard/pos_box_entries.py @@ -36,8 +36,9 @@ def get_journal(self, cr, uid, context): obj = self.pool.get('account.journal') statement_obj = self.pool.get('account.bank.statement') - user = self.pool.get('res.users').browse(cr, uid, uid) - ids = obj.search(cr, uid, [('type', '=', 'cash'), ('company_id', '=', user.company_id.id)]) + cr.execute("""select DISTINCT journal_id from pos_journal_users where user_id=%d order by journal_id"""%(uid)) + j_ids = map(lambda x1: x1[0], cr.fetchall()) + ids = obj.search(cr, uid, [('type', '=', 'cash'), ('id', 'in', j_ids)]) obj_ids= statement_obj.search(cr, uid, [('state', '!=', 'confirm'), ('user_id', '=', uid), ('journal_id', 'in', ids)]) res_obj = obj.read(cr, uid, ids, ['journal_id'], context) res_obj = [(r1['id'])for r1 in res_obj] diff --git a/addons/point_of_sale/wizard/pos_payment.py b/addons/point_of_sale/wizard/pos_payment.py index fb1119dc6c7..27c04a6dfba 100644 --- a/addons/point_of_sale/wizard/pos_payment.py +++ b/addons/point_of_sale/wizard/pos_payment.py @@ -47,8 +47,9 @@ class pos_make_payment(osv.osv_memory): active_id = context and context.get('active_id',False) if active_id: j_obj = self.pool.get('account.journal') - company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id - journal = j_obj.search(cr, uid, [('type', '=', 'cash'), ('company_id', '=', company_id)]) + cr.execute("""select DISTINCT journal_id from pos_journal_users where user_id=%d order by journal_id"""%(uid)) + j_ids = map(lambda x1: x1[0], cr.fetchall()) + journal = j_obj.search(cr, uid, [('type', '=', 'cash'), ('id', 'in', j_ids)]) if journal: journal = journal[0]