From c82f9afbbfacfeecb0db9edc12aedec802a035a9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Grignard?= Date: Tue, 14 Jan 2014 22:21:24 +0100 Subject: [PATCH] Display a warning when closing a session with a 0 balance. Not perfect since it completly forbids doing so and the message is not translated. --- pos_membership.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pos_membership.py b/pos_membership.py index e61b697..ab6933f 100644 --- a/pos_membership.py +++ b/pos_membership.py @@ -59,6 +59,19 @@ class pos_session(osv.osv): return { } + + def wkf_action_close(self, cr, uid, ids, context=None): + # Check that a register is not closed with a zero balance if it started with a positive balance + for record in self.browse(cr, uid, ids, context=context): + for st in record.statement_ids: + + if st.balance_start>0 and not st.balance_end_real: + # The pos manager can close sessions with 0 for the end balance. + if not self.pool.get('ir.model.access').check_groups(cr, uid, "point_of_sale.group_pos_manager"): + raise osv.except_osv( _('Please check your ending balance!'), + _("Your ending balance is zero, don't forget to enter it before closing the session! Leave around 20-30 EUR in the register.")) + return super(pos_session, self).wkf_action_close(cr, uid, ids, context) + pos_session() -- 2.20.1