[POS-commit] r8141 - in stoqlib/trunk/stoqlib/lib: . test

george at async.com.br george at async.com.br
Fri Jul 3 15:26:27 BRT 2009


Author: george
Date: Fri Jul  3 15:26:27 2009
New Revision: 8141

Log:
#4019: A data na impressao de Notas fiscais nao estao no formato do Brasil.
r=romaia

Modified:
   stoqlib/trunk/stoqlib/lib/invoice.py
   stoqlib/trunk/stoqlib/lib/test/sale-invoice-expected.txt

Modified: stoqlib/trunk/stoqlib/lib/invoice.py
==============================================================================
--- stoqlib/trunk/stoqlib/lib/invoice.py	Thu Jul  2 16:20:40 2009	(r8140)
+++ stoqlib/trunk/stoqlib/lib/invoice.py	Fri Jul  3 15:26:27 2009	(r8141)
@@ -136,6 +136,8 @@
 
 
 class _Invoice(object):
+    date_format = '%d-%m-%Y'
+
     def __init__(self, layout):
         self.layout = layout
         self.header_fields = []
@@ -491,7 +493,7 @@
     description = _('Emission date')
     length =  10
     def fetch(self, width, height):
-        return str(self.invoice.today.date())
+        return self.invoice.today.strftime(self.invoice.date_format)
 
 _add_invoice_field(F)
 
@@ -501,7 +503,7 @@
     description = _('Creation date')
     length =  10
     def fetch(self, width, height):
-        return str(self.invoice.today.date())
+        return self.invoice.today.strftime(self.invoice.date_format)
 
 _add_invoice_field(F)
 
@@ -511,7 +513,7 @@
     description = _('Creation time')
     length =  8
     def fetch(self, width, height):
-        return str(self.invoice.today.strftime('%H:%S'))
+        return self.invoice.today.strftime('%H:%S')
 
 _add_invoice_field(F)
 
@@ -531,7 +533,8 @@
     description = _('Payment due dates')
     length =  1
     def fetch(self, width, height):
-        dates = [str(p.due_date.date()) for p in self.sale.payments]
+        dates = [p.due_date.strftime(self.invoice.date_format)
+                                    for p in self.sale.payments]
         return ', '.join(dates)
 
 _add_invoice_field(F)

Modified: stoqlib/trunk/stoqlib/lib/test/sale-invoice-expected.txt
==============================================================================
--- stoqlib/trunk/stoqlib/lib/test/sale-invoice-expected.txt	Thu Jul  2 16:20:40 2009	(r8140)
+++ stoqlib/trunk/stoqlib/lib/test/sale-invoice-expected.txt	Fri Jul  3 15:26:27 2009	(r8141)
@@ -9,14 +9,14 @@
 SALE                   5.102                                                    
                                                                                 
                                                                                 
-CLIENT                                                                2007-01-01
+CLIENT                                                                01-01-2007
                                                                                 
-MAINSTREET 138, CIDADE ARACI        CIDADE ARACI          12345-678   2007-01-01
+MAINSTREET 138, CIDADE ARACI        CIDADE ARACI          12345-678   01-01-2007
                                                                                 
 ACAPULCO                  /                    WI                      10:30    
                                                                                 
                                                                                 
-1          2000-01-01                                       545.00              
+1          01-01-2000                                       545.00              
                                                                                 
                                                                                 
                                                                                 
@@ -71,14 +71,14 @@
 SALE                   5.102                                                    
                                                                                 
                                                                                 
-CLIENT                                                                2007-01-01
+CLIENT                                                                01-01-2007
                                                                                 
-MAINSTREET 138, CIDADE ARACI        CIDADE ARACI          12345-678   2007-01-01
+MAINSTREET 138, CIDADE ARACI        CIDADE ARACI          12345-678   01-01-2007
                                                                                 
 ACAPULCO                  /                    WI                      10:30    
                                                                                 
                                                                                 
-1          2000-01-01                                       545.00              
+1          01-01-2000                                       545.00              
                                                                                 
                                                                                 
                                                                                 


More information about the POS-commit mailing list