3 from openerp.osv import osv, fields
4 from openerp.tools.translate import _
6 from openerp.addons.account.wizard.pos_box import CashBox
11 def run(self, cr, uid, ids, context=None):
15 active_model = context.get('active_model', False) or False
16 active_ids = context.get('active_ids', []) or []
18 if active_model == 'pos.session':
19 records = self.pool.get(active_model).browse(cr, uid, active_ids, context=context)
20 bank_statements = [record.cash_register_id for record in records if record.cash_register_id]
22 if not bank_statements:
23 raise osv.except_osv(_('Error!'),
24 _("There is no cash register for this PoS Session"))
26 return self._run(cr, uid, ids, bank_statements, context=context)
28 return super(PosBox, self).run(cr, uid, ids, context=context)
30 class PosBoxIn(PosBox):
31 _inherit = 'cash.box.in'
33 def _compute_values_for_statement_line(self, cr, uid, box, record, context=None):
34 values = super(PosBoxIn, self)._compute_values_for_statement_line(cr, uid, box, record, context=context)
36 active_model = context.get('active_model', False) or False
37 active_ids = context.get('active_ids', []) or []
39 if active_model == 'pos.session':
40 session = self.pool.get(active_model).browse(cr, uid, active_ids, context=context)[0]
41 values['ref'] = session.name
46 class PosBoxOut(PosBox):
47 _inherit = 'cash.box.out'
49 def _compute_values_for_statement_line(self, cr, uid, box, record, context=None):
50 values = super(PosBoxOut, self)._compute_values_for_statement_line(cr, uid, box, record, context=context)
52 active_model = context.get('active_model', False) or False
53 active_ids = context.get('active_ids', []) or []
55 if active_model == 'pos.session':
56 session = self.pool.get(active_model).browse(cr, uid, active_ids, context=context)[0]
57 values['ref'] = session.name