[POS-commit] r5467 - in stoqlib/trunk/stoqlib: gui/editors

Johan Dahlin jdahlin at async.com.br
Tue Dec 5 11:31:09 BRST 2006


Author: jdahlin
Date: Tue Dec  5 11:31:09 2006
New Revision: 5467

Modified:
   stoqlib/trunk/stoqlib/gui/editors/tilleditor.py
   stoqlib/trunk/stoqlib/lib/drivers.py
   stoqlib/trunk/stoqlib/lib/interfaces.py

Log:
#2990: Adding & Removing cash should notify the fiscal printer. Also improve the cashin/out editors, so you can close them by pressing enter

Modified: stoqlib/trunk/stoqlib/gui/editors/tilleditor.py
==============================================================================
--- stoqlib/trunk/stoqlib/gui/editors/tilleditor.py	(original)
+++ stoqlib/trunk/stoqlib/gui/editors/tilleditor.py	Tue Dec  5 11:31:09 2006
@@ -35,6 +35,7 @@
 from stoqlib.domain.person import Person
 from stoqlib.domain.till import Till, TillEntry
 from stoqlib.gui.base.editors import BaseEditor, BaseEditorSlave
+from stoqlib.lib.drivers import till_add_cash, till_remove_cash
 from stoqlib.lib.translation import stoqlib_gettext
 
 _ = stoqlib_gettext
@@ -298,6 +299,11 @@
     gladefile = 'CashOutEditor'
     title = _(u'Reverse Payment')
 
+    def __init__(self, conn):
+        BaseEditor.__init__(self, conn)
+        self.main_dialog.set_confirm_widget(self.reason)
+        self.main_dialog.set_confirm_widget(self.cash_slave.value)
+
     #
     # BaseEditorSlave
     #
@@ -332,6 +338,7 @@
                 payment_description = _(u'Cash out')
             self.model.description = payment_description
 
+        till_remove_cash(self.conn, abs(self.cash_slave.model.value))
         return valid
 
     #
@@ -347,10 +354,15 @@
     It uses BashCashSlave without any extensions
     """
 
-    model_name = _(u'Cash Out')
+    model_name = _(u'Cash In')
     model_type = TillEntry
     gladefile = 'CashOutEditor'
 
+    def __init__(self, conn):
+        BaseEditor.__init__(self, conn)
+        self.main_dialog.set_confirm_widget(self.reason)
+        self.main_dialog.set_confirm_widget(self.cash_slave.value)
+
     #
     # BaseEditorSlave
     #
@@ -384,4 +396,5 @@
                 payment_description = _(u'Cash in')
             self.model.description = payment_description
 
+        till_add_cash(self.conn, self.cash_slave.model.value)
         return valid

Modified: stoqlib/trunk/stoqlib/lib/drivers.py
==============================================================================
--- stoqlib/trunk/stoqlib/lib/drivers.py	(original)
+++ stoqlib/trunk/stoqlib/lib/drivers.py	Tue Dec  5 11:31:09 2006
@@ -72,6 +72,7 @@
                _(u"There is no fiscal printer configured for this "
                 "station (\"%s\") or the printer is not enabled "
                 "currently." % station.name))
+
     return _printer
 
 def _get_scale(conn):
@@ -288,6 +289,15 @@
         printer.print_cheque(bank, payment.value, thirdparty, city)
 
 
+def till_add_cash(conn, value):
+    printer = _get_fiscalprinter(conn)
+    printer.till_add_cash(value)
+
+def till_remove_cash(conn, value):
+    printer = _get_fiscalprinter(conn)
+    printer.till_remove_cash(value)
+
+
 #
 # Class definitions
 #

Modified: stoqlib/trunk/stoqlib/lib/interfaces.py
==============================================================================
--- stoqlib/trunk/stoqlib/lib/interfaces.py	(original)
+++ stoqlib/trunk/stoqlib/lib/interfaces.py	Tue Dec  5 11:31:09 2006
@@ -100,4 +100,3 @@
 
     def yesno(text, default, *verbs):
         pass
-


More information about the POS-commit mailing list