X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=point_of_sale.py;h=dcfb14e78f251b380e2aaab1373a77bd0f41761f;hb=HEAD;hp=71b2eb6676926eb2202b94826b4588bb96a53574;hpb=805e36cb5fd89d7d74c50ddd6e2e66e46248e2b6;p=burette%2Fnrt_point_of_sale.git diff --git a/point_of_sale.py b/point_of_sale.py index 71b2eb6..dcfb14e 100644 --- a/point_of_sale.py +++ b/point_of_sale.py @@ -64,7 +64,10 @@ class pos_session(orm.Model): for session in self.browse(cr, uid, ids, context=context): account_move_ids = [] order_ids = [order.id for order in session.order_ids if order.state == 'done'] - company_id = order_obj.browse(cr, uid, order_ids, context=context)[0].company_id.id + if order_ids: + company_id = order_obj.browse(cr, uid, order_ids, context=context)[0].company_id.id + else: + company_id = self.pool.get('res.users').browse(cr, uid, [uid], context=context)[0].company_id.id for order in order_obj.browse(cr, uid, order_ids, context=context): if order.account_move.id not in account_move_ids: account_move_ids.append(order.account_move.id)