[POS-commit]
CVS: StandalonePOS/Domain Sale.py,1.4.2.1,1.4.2.1.2.1 Store.py,1.6,1.6.4.1
Bruno Trevisan
bt at async.com.br
Fri Feb 14 00:57:58 BRDT 2003
Update of /usr/local/cvssrc/StandalonePOS/Domain
In directory anthem:/tmp/cvs-serv6515/Domain
Modified Files:
Tag: release_1_1RC1
Sale.py Store.py
Log Message:
Code to support xmlrpc printer communication
cleans up a bug while trying to create the .gnome/Apps dir when user dont
hav
fixes difficulty to create pos-log file.
Thanks to mario@async.com.br for all the testing to jdahlin@async.com.br
for all the help and to kiko@async.com.br for keeping all us alive.
This branches release_1_1RC1
Index: Sale.py
===================================================================
RCS file: /usr/local/cvssrc/StandalonePOS/Domain/Sale.py,v
retrieving revision 1.4.2.1
retrieving revision 1.4.2.1.2.1
diff -u -d -r1.4.2.1 -r1.4.2.1.2.1
--- Sale.py 30 Jan 2002 13:09:06 -0000 1.4.2.1
+++ Sale.py 14 Feb 2003 01:57:55 -0000 1.4.2.1.2.1
@@ -20,15 +20,11 @@
import ZODB
import Domain
import Log
-import CORBA
from mx import DateTime
import types
d = Log.d
-class PrinterData:
- pass
-
class Sale(Domain.Persistent):
# items: list of saleitems
# payment_type: list of payments
@@ -145,11 +141,12 @@
del self.items[self.items.index(item)]
def make_saledata(self):
- saledata = PrinterData()
- saledata.discount = float(self.discount)
- saledata.vendor = int(self.vendor.id)
- saledata.installments = int(self.installments)
- saledata.payments = []
+ # we must use a dictionary here cause of xmlrpc
+ saledata = {}
+ saledata['discount'] = float(self.discount)
+ saledata['vendor'] = int(self.vendor.id)
+ saledata['installments'] = int(self.installments)
+ saledata['payments'] = []
for p in self.payments:
# The printer won't take our CHANGE type, so we guarantee
@@ -158,21 +155,21 @@
p.type.name == "CREDITCARD" or \
p.type.name == "CHEQUE":
- payment = PrinterData()
- payment.type = str(p.type.name)
- payment.value = float(p.value)
- saledata.payments.append(payment)
+ payment = {}
+ payment['type'] = str(p.type.name)
+ payment['value'] = float(p.value)
+ saledata['payments'].append(payment)
- saledata.items = []
+ saledata['items'] = []
for i in self.items:
- item = PrinterData()
- item.ref = str(i.product.ref)
- item.desc = str(i.product.desc)
- item.qty = int(i.qty)
- item.sellprice = float(i.sellprice)
- item.saletax = str(i.product.saletax.value)
- item.discount = float(i.discount)
- saledata.items.append(item)
+ item = {}
+ item['ref'] = str(i.product.ref)
+ item['desc'] = str(i.product.desc)
+ item['qty'] = int(i.qty)
+ item['sellprice'] = float(i.sellprice)
+ item['saletax'] = str(i.product.saletax.value)
+ item['discount'] = float(i.discount)
+ saledata['items'].append(item)
return saledata
def update_stock(self):
@@ -205,12 +202,8 @@
raise Sale.PaymentError, "Desconto é maior que o "+\
"total da venda."
data = self.make_saledata()
- try:
- nc = int(get_printer().print_cupon(data))
- except CORBA.COMM_FAILURE:
- raise Sale.PrinterError, "Couldn't access printer."\
- "Check printer server and printer status"
- self.cupon = nc
+ printer=get_printer()
+ self.cupon = int(printer.print_cupon(data))
self.fastclose()
@@ -298,7 +291,7 @@
self.open = 1
def close(self):
- get_printer().makeZ()
+ get_printer().summarize_and_close()
self.closedby = get_user()
self.closetime = DateTime.now()
self.open = 0
Index: Store.py
===================================================================
RCS file: /usr/local/cvssrc/StandalonePOS/Domain/Store.py,v
retrieving revision 1.6
retrieving revision 1.6.4.1
diff -u -d -r1.6 -r1.6.4.1
--- Store.py 23 Aug 2001 13:57:46 -0000 1.6
+++ Store.py 14 Feb 2003 01:57:55 -0000 1.6.4.1
@@ -42,21 +42,8 @@
self.journal_open = 1
def close_journal(self):
- try:
- self.journal.close()
- except CORBA.COMM_FAILURE:
- raise Store.PrinterError, "Couldn't access printer."\
- "Check printer server and printer status"
- else:
- self.journal_open = 0
-
- class PrinterError:
-
- def __init__(self, value=None):
- self.value = value
-
- def __str__(self):
- return self.value
+ self.journal.close()
+ self.journal_open = 0
class InShipment(Domain.Persistent):
More information about the POS-commit
mailing list