Author: jdahlin
Date: Mon Jul 31 08:34:40 2006
New Revision: 4031
Modified:
stoq/trunk/stoq/gui/pos/app.py
stoq/trunk/stoq/gui/pos/pos.py
Log:
Do separate cashier check outside of the application window
Modified: stoq/trunk/stoq/gui/pos/app.py
==============================================================================
--- stoq/trunk/stoq/gui/pos/app.py (original)
+++ stoq/trunk/stoq/gui/pos/app.py Mon Jul 31 08:34:40 2006
@@ -24,13 +24,28 @@
"""
stoq/gui/pos/app.py:
- Main callsite for POS application
+ Main callsite for POS application
"""
+import gettext
+
+from stoqlib.domain.till import get_current_till_operation
+from stoqlib.lib.message import error
+from stoqlib.lib.parameters import sysparam
+from stoqlib.lib.runtime import get_connection
+
from stoq.gui.application import App
from stoq.gui.pos.pos import POSApp
+_ = gettext.gettext
+
# Here we define config in the call site: /bin/stoq file
def main(config):
+ conn = get_connection()
+ param = sysparam(conn)
+ if (param.POS_SEPARATE_CASHIER and
+ not get_current_till_operation(conn)):
+ error(_(u"You need to open the till before start doing sales."))
+
app = App(POSApp, config)
app.run()
Modified: stoq/trunk/stoq/gui/pos/pos.py
==============================================================================
--- stoq/trunk/stoq/gui/pos/pos.py (original)
+++ stoq/trunk/stoq/gui/pos/pos.py Mon Jul 31 08:34:40 2006
@@ -37,7 +37,7 @@
from stoqdrivers.constants import UNIT_WEIGHT
from stoqlib.exceptions import (StoqlibError, DatabaseInconsistency)
from stoqlib.database import rollback_and_begin, finish_transaction
-from stoqlib.lib.message import error, warning, yesno
+from stoqlib.lib.message import warning, yesno
from stoqlib.lib.validators import format_quantity
from stoqlib.lib.runtime import new_transaction
from stoqlib.lib.parameters import sysparam
@@ -86,10 +86,6 @@
def __init__(self, app):
AppWindow.__init__(self, app)
self.param = sysparam(self.conn)
- if (self.param.POS_SEPARATE_CASHIER
- and not get_current_till_operation(self.conn)):
- error(_(u"You need to open the till before start doing sales."))
- self.app.shutdown()
self.max_results = self.param.MAX_SEARCH_RESULTS
self.client_table = PersonAdaptToClient
self._product_table = ProductAdaptToSellable