[IMP] point_of_sale: review the session workflow
[odoo/odoo.git] / addons / point_of_sale / wizard / pos_box.py
1 #!/usr/bin/env python
2 from osv import osv, fields
3 from account.wizard.pos_box import CashBox
4
5 class PosBox(CashBox):
6     _register = False
7
8     def run(self, cr, uid, ids, context=None):
9         if not context:
10             context = dict()
11
12         active_model = context.get('active_model', False) or False
13         active_ids = context.get('active_ids', []) or []
14
15         if active_model == 'pos.session':
16             records = self.pool.get(active_model).browse(cr, uid, context.get('active_ids', []) or [], context=context)
17             return self._run(cr, uid, ids, [record.cash_register_id for record in records], context=context)
18         else:
19             return super(PosBox, self).run(cr, uid, ids, context=context)
20
21 class PosBoxIn(PosBox):
22     _inherit = 'cash.box.in'
23
24 class PosBoxOut(PosBox):
25     _inherit = 'cash.box.out'
26