[IMP] point_of_sale: add a guardian for the account.bank.statement

bzr revid: stw@openerp.com-20120605122314-byw2uq6hjlas0052
This commit is contained in:
Stephane Wirtel
2012-06-05 14:23:14 +02:00
parent 85aec52251
commit d251e07d88
2 changed files with 29 additions and 24 deletions
+10 -1
View File
@@ -1,4 +1,6 @@
#!/usr/bin/env python
from tools.translate import _
from osv import osv, fields
from account.wizard.pos_box import CashBox
@@ -14,7 +16,14 @@ class PosBox(CashBox):
if active_model == 'pos.session':
records = self.pool.get(active_model).browse(cr, uid, context.get('active_ids', []) or [], context=context)
return self._run(cr, uid, ids, [record.cash_register_id for record in records], context=context)
bank_statements = [record.cash_register_id for record in records if record.cash_register_id]
if not bank_statements:
raise osv.except_osv(_('Error !'),
_("There is no cash register for this PoS Session"))
return self._run(cr, uid, ids, bank_statements, context=context)
else:
return super(PosBox, self).run(cr, uid, ids, context=context)
@@ -1,32 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<data>
<!-- Pos Receipt -->
<record id="view_pos_receipt" model="ir.ui.view">
<field name="name">Receipt</field>
<field name="model">pos.receipt</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Receipt :">
<separator string="Print the Receipt of the Sale" colspan="4"/>
<button icon='gtk-cancel' special="cancel"
string="Cancel" />
<button name="print_report" string="Print Receipt"
colspan="1" type="object" icon="gtk-print" />
</form>
</field>
</record>
<!-- Pos Receipt -->
<record id="view_pos_receipt" model="ir.ui.view">
<field name="name">Receipt</field>
<field name="model">pos.receipt</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Receipt :">
<separator string="Print the Receipt of the Sale" colspan="4"/>
<button icon='gtk-cancel' special="cancel"
string="Cancel" />
<button name="print_report" string="Print Receipt"
colspan="1" type="object" icon="gtk-print" />
</form>
</field>
</record>
<record id="action_report_pos_receipt" model="ir.actions.act_window">
<record id="action_report_pos_receipt" model="ir.actions.act_window">
<field name="name">Receipt</field>
<field name="res_model">pos.receipt</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="target">new</field>
</record>
</data>
</data>
</openerp>