2012-05-04 12:51:58 +00:00
|
|
|
#!/usr/bin/env python
|
2012-06-05 12:23:14 +00:00
|
|
|
|
|
|
|
from tools.translate import _
|
2012-05-04 12:51:58 +00:00
|
|
|
from osv import osv, fields
|
|
|
|
from account.wizard.pos_box import CashBox
|
|
|
|
|
|
|
|
class PosBox(CashBox):
|
|
|
|
_register = False
|
|
|
|
|
|
|
|
def run(self, cr, uid, ids, context=None):
|
|
|
|
if not context:
|
|
|
|
context = dict()
|
|
|
|
|
|
|
|
active_model = context.get('active_model', False) or False
|
|
|
|
active_ids = context.get('active_ids', []) or []
|
|
|
|
|
|
|
|
if active_model == 'pos.session':
|
|
|
|
records = self.pool.get(active_model).browse(cr, uid, context.get('active_ids', []) or [], context=context)
|
2012-06-05 12:23:14 +00:00
|
|
|
|
|
|
|
bank_statements = [record.cash_register_id for record in records if record.cash_register_id]
|
|
|
|
|
|
|
|
if not bank_statements:
|
2012-08-07 11:31:37 +00:00
|
|
|
raise osv.except_osv(_('Error!'),
|
2012-06-05 12:23:14 +00:00
|
|
|
_("There is no cash register for this PoS Session"))
|
|
|
|
|
|
|
|
return self._run(cr, uid, ids, bank_statements, context=context)
|
2012-05-04 12:51:58 +00:00
|
|
|
else:
|
|
|
|
return super(PosBox, self).run(cr, uid, ids, context=context)
|
|
|
|
|
|
|
|
class PosBoxIn(PosBox):
|
|
|
|
_inherit = 'cash.box.in'
|
|
|
|
|
|
|
|
class PosBoxOut(PosBox):
|
|
|
|
_inherit = 'cash.box.out'
|
|
|
|
|