3 from tools.translate import _
4 from osv import osv, fields
5 from account.wizard.pos_box import CashBox
10 def run(self, cr, uid, ids, context=None):
14 active_model = context.get('active_model', False) or False
15 active_ids = context.get('active_ids', []) or []
17 if active_model == 'pos.session':
18 records = self.pool.get(active_model).browse(cr, uid, active_ids, context=context)
19 bank_statements = [record.cash_register_id for record in records if record.cash_register_id]
21 if not bank_statements:
22 raise osv.except_osv(_('Error!'),
23 _("There is no cash register for this PoS Session"))
25 return self._run(cr, uid, ids, bank_statements, context=context)
27 return super(PosBox, self).run(cr, uid, ids, context=context)
29 class PosBoxIn(PosBox):
30 _inherit = 'cash.box.in'
32 def _compute_values_for_statement_line(self, cr, uid, box, record, context=None):
33 values = super(PosBoxIn, self)._compute_values_for_statement_line(cr, uid, box, record, context=context)
35 active_model = context.get('active_model', False) or False
36 active_ids = context.get('active_ids', []) or []
38 if active_model == 'pos.session':
39 session = self.pool.get(active_model).browse(cr, uid, active_ids, context=context)[0]
40 values['ref'] = session.name
45 class PosBoxOut(PosBox):
46 _inherit = 'cash.box.out'
48 def _compute_values_for_statement_line(self, cr, uid, box, record, context=None):
49 values = super(PosBoxOut, self)._compute_values_for_statement_line(cr, uid, box, record, context=context)
51 active_model = context.get('active_model', False) or False
52 active_ids = context.get('active_ids', []) or []
54 if active_model == 'pos.session':
55 session = self.pool.get(active_model).browse(cr, uid, active_ids, context=context)[0]
56 values['ref'] = session.name