2012-06-05 12:23:14 +00:00
|
|
|
|
[REM] removed details_summary, sales_user, sales_user_today, payment_user reports, wizards and rml
[REM] dead code: pos_box_entries.py/xml, pos_box_out.py/xml, pos_return_view.py/xml
[ADD] lines, invoice, cashbox of the day, payment, receipt, users product reports converted to QWeb. Added YML tests for the bank statement reports.
[FIX] closed cashbox of the day sql using old fields in its queries, yml test not correctly generating an invoice from a pos order
bzr revid: sle@openerp.com-20140414104954-xj10wi640tyr3ufe
2014-04-14 10:49:54 +00:00
|
|
|
from openerp.osv import osv
|
2012-12-06 14:56:32 +00:00
|
|
|
from openerp.tools.translate import _
|
|
|
|
|
|
|
|
from openerp.addons.account.wizard.pos_box import CashBox
|
2012-05-04 12:51:58 +00:00
|
|
|
|
|
|
|
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':
|
2013-03-29 14:37:20 +00:00
|
|
|
records = self.pool[active_model].browse(cr, uid, active_ids, 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'
|
|
|
|
|
2012-09-05 15:05:38 +00:00
|
|
|
def _compute_values_for_statement_line(self, cr, uid, box, record, context=None):
|
2013-03-05 13:14:55 +00:00
|
|
|
|
|
|
|
if context is None:
|
|
|
|
context = {}
|
|
|
|
|
2012-09-05 15:05:38 +00:00
|
|
|
values = super(PosBoxIn, self)._compute_values_for_statement_line(cr, uid, box, record, context=context)
|
|
|
|
|
|
|
|
active_model = context.get('active_model', False) or False
|
|
|
|
active_ids = context.get('active_ids', []) or []
|
|
|
|
|
|
|
|
if active_model == 'pos.session':
|
2013-03-29 14:37:20 +00:00
|
|
|
session = self.pool[active_model].browse(cr, uid, active_ids, context=context)[0]
|
2012-09-05 15:05:38 +00:00
|
|
|
values['ref'] = session.name
|
|
|
|
|
|
|
|
return values
|
|
|
|
|
|
|
|
|
2012-05-04 12:51:58 +00:00
|
|
|
class PosBoxOut(PosBox):
|
|
|
|
_inherit = 'cash.box.out'
|
|
|
|
|
2012-09-05 15:05:38 +00:00
|
|
|
def _compute_values_for_statement_line(self, cr, uid, box, record, context=None):
|
|
|
|
values = super(PosBoxOut, self)._compute_values_for_statement_line(cr, uid, box, record, context=context)
|
|
|
|
|
|
|
|
active_model = context.get('active_model', False) or False
|
|
|
|
active_ids = context.get('active_ids', []) or []
|
|
|
|
|
|
|
|
if active_model == 'pos.session':
|
2013-03-29 14:37:20 +00:00
|
|
|
session = self.pool[active_model].browse(cr, uid, active_ids, context=context)[0]
|
2012-09-05 15:05:38 +00:00
|
|
|
values['ref'] = session.name
|
|
|
|
|
|
|
|
return values
|