Merge lp:~bellini666/stoq/pyflakes_improvements into lp:~stoq-dev/stoq/master
- pyflakes_improvements
- Merge into master
Status: | Merged |
---|---|
Merged at revision: | 4393 |
Proposed branch: | lp:~bellini666/stoq/pyflakes_improvements |
Merge into: | lp:~stoq-dev/stoq/master |
Diff against target: |
1428 lines (+194/-228) 74 files modified
Makefile (+1/-1) plugins/books/bookssearch.py (+0/-1) plugins/books/booksslave.py (+0/-3) plugins/books/booksui.py (+0/-3) plugins/books/publishersearch.py (+1/-8) plugins/ecf/ecfui.py (+1/-5) plugins/ecf/tests/test_device.py (+0/-1) plugins/nfe/nfegenerator.py (+0/-5) plugins/nfe/nfeui.py (+0/-1) stoq/dbadmin.py (+4/-4) stoq/gui/pos.py (+0/-1) stoq/gui/receivable.py (+1/-19) stoq/gui/stock.py (+0/-1) stoqlib/chart/chart.py (+7/-7) stoqlib/chart/chartserver.py (+5/-3) stoqlib/chart/paymentcharts.py (+3/-0) stoqlib/database/admin.py (+4/-4) stoqlib/database/database.py (+2/-2) stoqlib/database/migration.py (+1/-2) stoqlib/database/runtime.py (+1/-1) stoqlib/database/testsuite.py (+1/-1) stoqlib/domain/address.py (+1/-1) stoqlib/domain/base.py (+1/-1) stoqlib/domain/devices.py (+0/-2) stoqlib/domain/event.py (+3/-3) stoqlib/domain/product.py (+1/-2) stoqlib/domain/test/test_nfe.py (+1/-2) stoqlib/domain/test/test_person.py (+0/-2) stoqlib/domain/test/test_sellable.py (+1/-1) stoqlib/gui/accounttree.py (+0/-1) stoqlib/gui/base/lists.py (+0/-1) stoqlib/gui/dialogs/branchdialog.py (+0/-4) stoqlib/gui/dialogs/chartdialog.py (+2/-0) stoqlib/gui/dialogs/productiondialog.py (+0/-3) stoqlib/gui/dialogs/productionquotedialog.py (+0/-1) stoqlib/gui/dialogs/purchasedetails.py (+0/-1) stoqlib/gui/editors/accounttransactioneditor.py (+0/-1) stoqlib/gui/editors/personeditor.py (+1/-1) stoqlib/gui/editors/profileeditor.py (+0/-2) stoqlib/gui/editors/sellableeditor.py (+0/-1) stoqlib/gui/editors/tilleditor.py (+2/-3) stoqlib/gui/fiscalprinter.py (+1/-3) stoqlib/gui/printing.py (+0/-24) stoqlib/gui/search/eventsearch.py (+0/-2) stoqlib/gui/search/fiscalsearch.py (+0/-2) stoqlib/gui/slaves/employeeslave.py (+0/-3) stoqlib/gui/slaves/paymentmethodslave.py (+0/-2) stoqlib/gui/slaves/userslave.py (+1/-2) stoqlib/gui/splash.py (+0/-1) stoqlib/gui/templates/individualtemplate.py (+0/-1) stoqlib/gui/wizards/purchasewizard.py (+1/-2) stoqlib/importers/branchimporter.py (+10/-7) stoqlib/importers/clientimporter.py (+9/-6) stoqlib/importers/creditproviderimporter.py (+7/-6) stoqlib/importers/csvimporter.py (+2/-4) stoqlib/importers/employeeimporter.py (+8/-7) stoqlib/importers/ofximporter.py (+0/-1) stoqlib/importers/purchaseimporter.py (+8/-6) stoqlib/importers/serviceimporter.py (+2/-2) stoqlib/importers/supplierimporter.py (+9/-6) stoqlib/importers/transporterimporter.py (+9/-6) stoqlib/lib/devicemanager.py (+1/-0) stoqlib/lib/imageutils.py (+0/-2) stoqlib/lib/test/test_ofximporter.py (+0/-6) stoqlib/lib/test/test_parameters.py (+3/-4) stoqlib/lib/test/test_sintegra.py (+0/-2) stoqlib/lib/test/test_sintegragenerator.py (+2/-2) stoqlib/lib/xmlrpc.py (+1/-1) stoqlib/reporting/product.py (+0/-1) stoqlib/reporting/purchase.py (+0/-1) stoqlib/reporting/sale.py (+0/-2) stoqlib/reporting/template.py (+0/-1) stoqlib/reporting/tests/test_reporting.py (+7/-7) stoqlib/test/test_pyflakes.py (+68/-0) |
To merge this branch: | bzr merge lp:~bellini666/stoq/pyflakes_improvements |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ronaldo Maia | Pending | ||
Review via email: mp+80917@code.launchpad.net |
Commit message
Description of the change
Correções do Pyflakes e adição de testes.
* Corrigi vários erros e warnings de pyflakes pelo código (stoq, stoqlib e plugins).
* Alguns lugares a correção é estranha, como a remoção de um método inteiro. Esses casos era porque esse método estava sendo redefinido em baixo, logo não estava sendo usado. Até mesmo alguns erros de variáveis não definidas foram resolvidos. (o caso do charts, onde adicionei um XXX, aquela classe pelo log tem apenas a implementação inicial e lá mesmo diz que ela não funciona).
* Adicionei testes para testar pyflakes em stoq, stoqlib e plugins. Vai ser EXTREMAMENTE ÚTIL para encontrar erros de syntax que cometemos as vezes, e podem acabar despercebidos até um usuário chamar aquela função.
Não fiz nenhuma mudança funcional no código, apenas correções de pyflakes mesmo! Rodei os testes sem STOQLIB_TEST_QUICK e testei a gui em várias partes para ter certeza de que tudo ainda estava dentro dos conformes.
- 4389. By Launchpad Translations on behalf of stoq-dev
-
Launchpad automatic translations update.
- 4390. By Launchpad Translations on behalf of stoq-dev
-
Launchpad automatic translations update.
- 4391. By Johan Dahlin
-
Pass in self.wizard to all dialogs created in wizard steps
Johan Dahlin (jdahlin-deactivatedaccount) wrote : | # |
- 4392. By Thiago Bellini
-
Correct 2 test methods names.
* test_runtime had a 'setDown' method. It wasn't really necessary as 'setUp'
has it's logic in it. That's why it didn't interfered in nothing on test,
since the right name for it would be 'tearDown'. Just removing it.
* TestReport's 'setUp' logic was written on 'tearUp'. For that reason, it
wasn't being called and the workaround it tried to apply wasn't working (I
didn't noticed it when I wrote the patch because I had no cache at the
moment, and jenkins never fail on that test). Rename it and everything should
be fine!Maybe we should try to create a pattern on tests. Use 'setUp/setDown' or
'tearUp/tearDown' (I think the second makes more sense) to avoid problems like
that, that happened for distraction and the assumption of a pattern.
Thiago Bellini (bellini666) wrote : | # |
Johan: Valeu :) Vou comitar então
Preview Diff
1 | === modified file 'Makefile' | |||
2 | --- Makefile 2011-07-11 03:30:12 +0000 | |||
3 | +++ Makefile 2011-11-05 17:07:26 +0000 | |||
4 | @@ -29,7 +29,7 @@ | |||
5 | 29 | pep8 stoq stoqlib | 29 | pep8 stoq stoqlib |
6 | 30 | 30 | ||
7 | 31 | pyflakes: | 31 | pyflakes: |
9 | 32 | pyflakes stoq stoqlib | 32 | pyflakes stoq stoqlib plugins |
10 | 33 | 33 | ||
11 | 34 | check: | 34 | check: |
12 | 35 | LC_ALL=C trial stoq stoqlib | 35 | LC_ALL=C trial stoq stoqlib |
13 | 36 | 36 | ||
14 | === modified file 'plugins/books/bookssearch.py' | |||
15 | --- plugins/books/bookssearch.py 2011-05-19 17:52:30 +0000 | |||
16 | +++ plugins/books/bookssearch.py 2011-11-05 17:07:26 +0000 | |||
17 | @@ -32,7 +32,6 @@ | |||
18 | 32 | 32 | ||
19 | 33 | from stoqlib.domain.sellable import Sellable | 33 | from stoqlib.domain.sellable import Sellable |
20 | 34 | from stoqlib.gui.search.productsearch import ProductSearch | 34 | from stoqlib.gui.search.productsearch import ProductSearch |
21 | 35 | from stoqlib.lib.defaults import sort_sellable_code | ||
22 | 36 | from stoqlib.lib.translation import stoqlib_gettext as _ | 35 | from stoqlib.lib.translation import stoqlib_gettext as _ |
23 | 37 | from stoqlib.lib.formatters import format_quantity, get_formatted_cost | 36 | from stoqlib.lib.formatters import format_quantity, get_formatted_cost |
24 | 38 | 37 | ||
25 | 39 | 38 | ||
26 | === modified file 'plugins/books/booksslave.py' | |||
27 | --- plugins/books/booksslave.py 2011-02-08 14:06:58 +0000 | |||
28 | +++ plugins/books/booksslave.py 2011-11-05 17:07:26 +0000 | |||
29 | @@ -30,10 +30,7 @@ | |||
30 | 30 | from kiwi.datatypes import ValidationError | 30 | from kiwi.datatypes import ValidationError |
31 | 31 | 31 | ||
32 | 32 | from stoqlib.gui.editors.baseeditor import BaseEditorSlave | 32 | from stoqlib.gui.editors.baseeditor import BaseEditorSlave |
33 | 33 | from stoqlib.gui.slaves.sellableslave import SellableDetailsSlave | ||
34 | 34 | from stoqlib.domain.interfaces import IStorable | ||
35 | 35 | from stoqlib.domain.person import Person | 33 | from stoqlib.domain.person import Person |
36 | 36 | from stoqlib.domain.product import Product | ||
37 | 37 | from stoqlib.lib.countries import get_countries | 34 | from stoqlib.lib.countries import get_countries |
38 | 38 | from stoqlib.lib.translation import stoqlib_gettext | 35 | from stoqlib.lib.translation import stoqlib_gettext |
39 | 39 | 36 | ||
40 | 40 | 37 | ||
41 | === modified file 'plugins/books/booksui.py' | |||
42 | --- plugins/books/booksui.py 2011-02-08 14:06:58 +0000 | |||
43 | +++ plugins/books/booksui.py 2011-11-05 17:07:26 +0000 | |||
44 | @@ -22,8 +22,6 @@ | |||
45 | 22 | ## Author(s): Stoq Team <stoq-devel@async.com.br> | 22 | ## Author(s): Stoq Team <stoq-devel@async.com.br> |
46 | 23 | ## | 23 | ## |
47 | 24 | 24 | ||
48 | 25 | import os | ||
49 | 26 | |||
50 | 27 | import gtk | 25 | import gtk |
51 | 28 | 26 | ||
52 | 29 | from kiwi.log import Logger | 27 | from kiwi.log import Logger |
53 | @@ -31,7 +29,6 @@ | |||
54 | 31 | from stoqlib.database.runtime import get_connection | 29 | from stoqlib.database.runtime import get_connection |
55 | 32 | from stoqlib.gui.base.dialogs import run_dialog | 30 | from stoqlib.gui.base.dialogs import run_dialog |
56 | 33 | from stoqlib.gui.events import StartApplicationEvent | 31 | from stoqlib.gui.events import StartApplicationEvent |
57 | 34 | from stoqlib.lib.message import info | ||
58 | 35 | from stoqlib.lib.translation import stoqlib_gettext | 32 | from stoqlib.lib.translation import stoqlib_gettext |
59 | 36 | 33 | ||
60 | 37 | from bookssearch import ProductBookSearch | 34 | from bookssearch import ProductBookSearch |
61 | 38 | 35 | ||
62 | === modified file 'plugins/books/publishersearch.py' | |||
63 | --- plugins/books/publishersearch.py 2011-05-19 17:52:30 +0000 | |||
64 | +++ plugins/books/publishersearch.py 2011-11-05 17:07:26 +0000 | |||
65 | @@ -24,17 +24,10 @@ | |||
66 | 24 | 24 | ||
67 | 25 | """ Search dialog/Editor for publishers """ | 25 | """ Search dialog/Editor for publishers """ |
68 | 26 | 26 | ||
73 | 27 | from kiwi.argcheck import argcheck | 27 | from kiwi.ui.objectlist import SearchColumn |
70 | 28 | from kiwi.enums import SearchFilterPosition | ||
71 | 29 | from kiwi.ui.search import ComboSearchFilter | ||
72 | 30 | from kiwi.ui.objectlist import Column, SearchColumn | ||
74 | 31 | 28 | ||
75 | 32 | from stoqlib.database.runtime import new_transaction | ||
76 | 33 | from stoqlib.lib.translation import stoqlib_gettext | 29 | from stoqlib.lib.translation import stoqlib_gettext |
77 | 34 | from stoqlib.lib.formatters import format_phone_number | ||
78 | 35 | 30 | ||
79 | 36 | from stoqlib.gui.base.search import SearchEditor, SearchDialog | ||
80 | 37 | from stoqlib.gui.base.dialogs import run_dialog | ||
81 | 38 | from stoqlib.gui.search.personsearch import BasePersonSearch | 31 | from stoqlib.gui.search.personsearch import BasePersonSearch |
82 | 39 | from stoqlib.gui.templates.persontemplate import BasePersonRoleEditor | 32 | from stoqlib.gui.templates.persontemplate import BasePersonRoleEditor |
83 | 40 | 33 | ||
84 | 41 | 34 | ||
85 | === modified file 'plugins/ecf/ecfui.py' | |||
86 | --- plugins/ecf/ecfui.py 2011-10-05 19:46:41 +0000 | |||
87 | +++ plugins/ecf/ecfui.py 2011-11-05 17:07:26 +0000 | |||
88 | @@ -55,7 +55,6 @@ | |||
89 | 55 | from couponprinter import CouponPrinter | 55 | from couponprinter import CouponPrinter |
90 | 56 | from ecfdomain import ECFPrinter, FiscalSaleHistory | 56 | from ecfdomain import ECFPrinter, FiscalSaleHistory |
91 | 57 | from ecfprinterdialog import ECFListDialog | 57 | from ecfprinterdialog import ECFListDialog |
92 | 58 | from ecfprinterstatus import ECFAsyncPrinterStatus | ||
93 | 59 | from ecfmemorydialog import FiscalMemoryDialog | 58 | from ecfmemorydialog import FiscalMemoryDialog |
94 | 60 | from paulistainvoicedialog import PaulistaInvoiceDialog | 59 | from paulistainvoicedialog import PaulistaInvoiceDialog |
95 | 61 | 60 | ||
96 | @@ -104,9 +103,6 @@ | |||
97 | 104 | _("This operation requires a connected fiscal printer")) | 103 | _("This operation requires a connected fiscal printer")) |
98 | 105 | 104 | ||
99 | 106 | if not self._printer_verified: | 105 | if not self._printer_verified: |
100 | 107 | domain = self._printer.get_printer() | ||
101 | 108 | driver = self._printer.get_driver() | ||
102 | 109 | |||
103 | 110 | if not self._printer.check_serial(): | 106 | if not self._printer.check_serial(): |
104 | 111 | raise DeviceError( | 107 | raise DeviceError( |
105 | 112 | _("Fiscalprinters serial number is different!")) | 108 | _("Fiscalprinters serial number is different!")) |
106 | @@ -198,7 +194,7 @@ | |||
107 | 198 | log.info('ecfui._check_printer') | 194 | log.info('ecfui._check_printer') |
108 | 199 | try: | 195 | try: |
109 | 200 | self._validate_printer() | 196 | self._validate_printer() |
111 | 201 | except (DriverError, DeviceError), details: | 197 | except (DriverError, DeviceError): |
112 | 202 | warning('Não foi possível comunicar com a impressora.') | 198 | warning('Não foi possível comunicar com a impressora.') |
113 | 203 | raise SystemExit | 199 | raise SystemExit |
114 | 204 | 200 | ||
115 | 205 | 201 | ||
116 | === modified file 'plugins/ecf/tests/test_device.py' | |||
117 | --- plugins/ecf/tests/test_device.py 2011-06-21 13:31:33 +0000 | |||
118 | +++ plugins/ecf/tests/test_device.py 2011-11-05 17:07:26 +0000 | |||
119 | @@ -85,7 +85,6 @@ | |||
120 | 85 | settings = self.create_ecf_printer() | 85 | settings = self.create_ecf_printer() |
121 | 86 | settings.create_fiscal_printer_constants() | 86 | settings.create_fiscal_printer_constants() |
122 | 87 | 87 | ||
123 | 88 | constants = list(settings.constants) | ||
124 | 89 | for constant_type in [DeviceConstant.TYPE_UNIT, | 88 | for constant_type in [DeviceConstant.TYPE_UNIT, |
125 | 90 | DeviceConstant.TYPE_TAX, | 89 | DeviceConstant.TYPE_TAX, |
126 | 91 | DeviceConstant.TYPE_PAYMENT]: | 90 | DeviceConstant.TYPE_PAYMENT]: |
127 | 92 | 91 | ||
128 | === modified file 'plugins/nfe/nfegenerator.py' | |||
129 | --- plugins/nfe/nfegenerator.py 2011-10-27 16:07:50 +0000 | |||
130 | +++ plugins/nfe/nfegenerator.py 2011-11-05 17:07:26 +0000 | |||
131 | @@ -30,9 +30,6 @@ | |||
132 | 30 | from xml.etree.ElementTree import Element | 30 | from xml.etree.ElementTree import Element |
133 | 31 | from xml.sax.saxutils import escape | 31 | from xml.sax.saxutils import escape |
134 | 32 | 32 | ||
135 | 33 | from stoqdrivers.enum import TaxType | ||
136 | 34 | |||
137 | 35 | import stoqlib | ||
138 | 36 | from stoqlib.domain.interfaces import ICompany, IIndividual | 33 | from stoqlib.domain.interfaces import ICompany, IIndividual |
139 | 37 | from stoqlib.exceptions import ModelDataError | 34 | from stoqlib.exceptions import ModelDataError |
140 | 38 | from stoqlib.lib.parameters import sysparam | 35 | from stoqlib.lib.parameters import sysparam |
141 | @@ -449,7 +446,6 @@ | |||
142 | 449 | def as_txt(self): | 446 | def as_txt(self): |
143 | 450 | txt = u'%s|%s|%s|\n' % (self.txttag, self.element.get('versao'), | 447 | txt = u'%s|%s|%s|\n' % (self.txttag, self.element.get('versao'), |
144 | 451 | self.get_id_value()) | 448 | self.get_id_value()) |
145 | 452 | children = self.get_children() | ||
146 | 453 | for child in self.get_children(): | 449 | for child in self.get_children(): |
147 | 454 | txt += child.as_txt() | 450 | txt += child.as_txt() |
148 | 455 | 451 | ||
149 | @@ -1599,7 +1595,6 @@ | |||
150 | 1599 | 1595 | ||
151 | 1600 | address = person.get_main_address() | 1596 | address = person.get_main_address() |
152 | 1601 | if address: | 1597 | if address: |
153 | 1602 | postal_code = ''.join([i for i in address.postal_code if i in '1234567890']) | ||
154 | 1603 | self.set_attr('xEnder', address.get_address_string()[:60]) | 1598 | self.set_attr('xEnder', address.get_address_string()[:60]) |
155 | 1604 | self.set_attr('xMun', address.city_location.city[:60]) | 1599 | self.set_attr('xMun', address.city_location.city[:60]) |
156 | 1605 | self.set_attr('UF', address.city_location.state) | 1600 | self.set_attr('UF', address.city_location.state) |
157 | 1606 | 1601 | ||
158 | === modified file 'plugins/nfe/nfeui.py' | |||
159 | --- plugins/nfe/nfeui.py 2011-10-19 19:44:32 +0000 | |||
160 | +++ plugins/nfe/nfeui.py 2011-11-05 17:07:26 +0000 | |||
161 | @@ -31,7 +31,6 @@ | |||
162 | 31 | from stoqlib.domain.sale import Sale | 31 | from stoqlib.domain.sale import Sale |
163 | 32 | from stoqlib.gui.events import StartApplicationEvent | 32 | from stoqlib.gui.events import StartApplicationEvent |
164 | 33 | from stoqlib.lib.osutils import get_application_dir | 33 | from stoqlib.lib.osutils import get_application_dir |
165 | 34 | from stoqlib.lib.message import info | ||
166 | 35 | from stoqlib.lib.translation import stoqlib_gettext | 34 | from stoqlib.lib.translation import stoqlib_gettext |
167 | 36 | 35 | ||
168 | 37 | from nfegenerator import NFeGenerator | 36 | from nfegenerator import NFeGenerator |
169 | 38 | 37 | ||
170 | === modified file 'stoq/dbadmin.py' | |||
171 | --- stoq/dbadmin.py 2011-11-01 01:13:11 +0000 | |||
172 | +++ stoq/dbadmin.py 2011-11-05 17:07:26 +0000 | |||
173 | @@ -192,10 +192,10 @@ | |||
174 | 192 | branch = None | 192 | branch = None |
175 | 193 | 193 | ||
176 | 194 | try: | 194 | try: |
181 | 195 | station = BranchStation(connection=trans, | 195 | BranchStation(connection=trans, |
182 | 196 | is_active=True, | 196 | is_active=True, |
183 | 197 | branch=branch, | 197 | branch=branch, |
184 | 198 | name=socket.gethostname()) | 198 | name=socket.gethostname()) |
185 | 199 | except StoqlibError, e: | 199 | except StoqlibError, e: |
186 | 200 | raise SystemExit("ERROR: %s" % e) | 200 | raise SystemExit("ERROR: %s" % e) |
187 | 201 | 201 | ||
188 | 202 | 202 | ||
189 | === modified file 'stoq/gui/pos.py' | |||
190 | --- stoq/gui/pos.py 2011-11-01 01:13:11 +0000 | |||
191 | +++ stoq/gui/pos.py 2011-11-05 17:07:26 +0000 | |||
192 | @@ -511,7 +511,6 @@ | |||
193 | 511 | self.set_sensitive([self.advanced_search], has_quantity) | 511 | self.set_sensitive([self.advanced_search], has_quantity) |
194 | 512 | 512 | ||
195 | 513 | def _read_quantity(self): | 513 | def _read_quantity(self): |
196 | 514 | quantity_text = self.quantity.get_text() | ||
197 | 515 | try: | 514 | try: |
198 | 516 | quantity = self.quantity.read() | 515 | quantity = self.quantity.read() |
199 | 517 | except ValidationError: | 516 | except ValidationError: |
200 | 518 | 517 | ||
201 | === modified file 'stoq/gui/receivable.py' | |||
202 | --- stoq/gui/receivable.py 2011-10-24 13:53:17 +0000 | |||
203 | +++ stoq/gui/receivable.py 2011-11-05 17:07:26 +0000 | |||
204 | @@ -35,7 +35,7 @@ | |||
205 | 35 | from kiwi.datatypes import currency | 35 | from kiwi.datatypes import currency |
206 | 36 | from kiwi.enums import SearchFilterPosition | 36 | from kiwi.enums import SearchFilterPosition |
207 | 37 | from kiwi.python import all | 37 | from kiwi.python import all |
209 | 38 | from kiwi.ui.search import ComboSearchFilter, DateSearchOption | 38 | from kiwi.ui.search import ComboSearchFilter |
210 | 39 | from kiwi.ui.objectlist import SearchColumn, Column | 39 | from kiwi.ui.objectlist import SearchColumn, Column |
211 | 40 | from stoqlib.database.runtime import new_transaction, finish_transaction | 40 | from stoqlib.database.runtime import new_transaction, finish_transaction |
212 | 41 | from stoqlib.domain.payment.operation import register_payment_operations | 41 | from stoqlib.domain.payment.operation import register_payment_operations |
213 | @@ -64,24 +64,6 @@ | |||
214 | 64 | 64 | ||
215 | 65 | _ = gettext.gettext | 65 | _ = gettext.gettext |
216 | 66 | 66 | ||
217 | 67 | class NextMonthOption(DateSearchOption): | ||
218 | 68 | name = _('Next month') | ||
219 | 69 | def get_interval(self): | ||
220 | 70 | today = datetime.date.today() | ||
221 | 71 | year = today.year | ||
222 | 72 | month = today.month + 1 | ||
223 | 73 | if month > 12: | ||
224 | 74 | month = 1 | ||
225 | 75 | year += 1 | ||
226 | 76 | # Try 31 first then add one until date() does not complain. | ||
227 | 77 | day = today.day | ||
228 | 78 | while True: | ||
229 | 79 | try: | ||
230 | 80 | end_date = datetime.date(year, month, day) | ||
231 | 81 | break | ||
232 | 82 | except ValueError: | ||
233 | 83 | day += 1 | ||
234 | 84 | return datetime.date.today(), end_date | ||
235 | 85 | 67 | ||
236 | 86 | class ReceivableApp(SearchableAppWindow): | 68 | class ReceivableApp(SearchableAppWindow): |
237 | 87 | 69 | ||
238 | 88 | 70 | ||
239 | === modified file 'stoq/gui/stock.py' | |||
240 | --- stoq/gui/stock.py 2011-10-04 16:01:38 +0000 | |||
241 | +++ stoq/gui/stock.py 2011-11-05 17:07:26 +0000 | |||
242 | @@ -41,7 +41,6 @@ | |||
243 | 41 | from stoqlib.domain.sellable import Sellable | 41 | from stoqlib.domain.sellable import Sellable |
244 | 42 | from stoqlib.domain.views import ProductFullStockView | 42 | from stoqlib.domain.views import ProductFullStockView |
245 | 43 | from stoqlib.lib.defaults import sort_sellable_code | 43 | from stoqlib.lib.defaults import sort_sellable_code |
246 | 44 | from stoqlib.lib.message import warning | ||
247 | 45 | from stoqlib.gui.editors.producteditor import ProductStockEditor | 44 | from stoqlib.gui.editors.producteditor import ProductStockEditor |
248 | 46 | from stoqlib.gui.wizards.loanwizard import NewLoanWizard, CloseLoanWizard | 45 | from stoqlib.gui.wizards.loanwizard import NewLoanWizard, CloseLoanWizard |
249 | 47 | from stoqlib.gui.wizards.receivingwizard import ReceivingOrderWizard | 46 | from stoqlib.gui.wizards.receivingwizard import ReceivingOrderWizard |
250 | 48 | 47 | ||
251 | === modified file 'stoqlib/chart/chart.py' | |||
252 | --- stoqlib/chart/chart.py 2011-07-01 18:41:05 +0000 | |||
253 | +++ stoqlib/chart/chart.py 2011-11-05 17:07:26 +0000 | |||
254 | @@ -23,13 +23,13 @@ | |||
255 | 23 | ## | 23 | ## |
256 | 24 | """ Charting """ | 24 | """ Charting """ |
257 | 25 | 25 | ||
265 | 26 | import datetime | 26 | import pprint |
266 | 27 | import gettext | 27 | |
267 | 28 | import string | 28 | from kiwi.python import namedAny |
268 | 29 | 29 | from stoqlib.lib.translation import stoqlib_gettext | |
269 | 30 | from kiwi.python import namedAny, Settable | 30 | |
270 | 31 | 31 | _ = stoqlib_gettext | |
271 | 32 | _ = gettext.gettext | 32 | |
272 | 33 | 33 | ||
273 | 34 | class DateArgument(object): | 34 | class DateArgument(object): |
274 | 35 | pass | 35 | pass |
275 | 36 | 36 | ||
276 | === modified file 'stoqlib/chart/chartserver.py' | |||
277 | --- stoqlib/chart/chartserver.py 2011-07-01 18:41:05 +0000 | |||
278 | +++ stoqlib/chart/chartserver.py 2011-11-05 17:07:26 +0000 | |||
279 | @@ -26,15 +26,14 @@ | |||
280 | 26 | import cgi | 26 | import cgi |
281 | 27 | import json | 27 | import json |
282 | 28 | 28 | ||
283 | 29 | from kiwi.environ import environ | ||
284 | 30 | from twisted.internet import reactor | 29 | from twisted.internet import reactor |
285 | 31 | from twisted.web.resource import Resource | 30 | from twisted.web.resource import Resource |
286 | 32 | from twisted.web.server import Site | 31 | from twisted.web.server import Site |
287 | 33 | from twisted.web.static import File | 32 | from twisted.web.static import File |
288 | 34 | 33 | ||
289 | 35 | from stoqlib.chart.chart import get_chart_class | 34 | from stoqlib.chart.chart import get_chart_class |
290 | 35 | from stoqlib.database.runtime import get_connection | ||
291 | 36 | from stoqlib.lib.template import render_template | 36 | from stoqlib.lib.template import render_template |
292 | 37 | |||
293 | 38 | from stoqlib.lib.translation import stoqlib_gettext | 37 | from stoqlib.lib.translation import stoqlib_gettext |
294 | 39 | 38 | ||
295 | 40 | _ = stoqlib_gettext | 39 | _ = stoqlib_gettext |
296 | @@ -53,6 +52,8 @@ | |||
297 | 53 | class ChartChartResource(Resource): | 52 | class ChartChartResource(Resource): |
298 | 54 | 53 | ||
299 | 55 | def _get_chart(self, request): | 54 | def _get_chart(self, request): |
300 | 55 | conn = get_connection() | ||
301 | 56 | |||
302 | 56 | if not '?' in request.uri: | 57 | if not '?' in request.uri: |
303 | 57 | raise TypeError("Missing arguments") | 58 | raise TypeError("Missing arguments") |
304 | 58 | args = cgi.parse_qs(request.uri.split('?', 1)[1]) | 59 | args = cgi.parse_qs(request.uri.split('?', 1)[1]) |
305 | @@ -70,7 +71,8 @@ | |||
306 | 70 | opt['data'] = chart.run() | 71 | opt['data'] = chart.run() |
307 | 71 | opt['options'] = { | 72 | opt['options'] = { |
308 | 72 | "xaxis": { "mode": "time" }, | 73 | "xaxis": { "mode": "time" }, |
310 | 73 | "bars": { "show": True, "barWidth": 20 * _JS_DAY }, | 74 | # XXX: _JS_DAY is not defined |
311 | 75 | #"bars": { "show": True, "barWidth": 20 * _JS_DAY }, | ||
312 | 74 | "points": { "show": False }, | 76 | "points": { "show": False }, |
313 | 75 | "lines": { "show": False }, | 77 | "lines": { "show": False }, |
314 | 76 | "grid": { "hoverable": True, | 78 | "grid": { "hoverable": True, |
315 | 77 | 79 | ||
316 | === modified file 'stoqlib/chart/paymentcharts.py' | |||
317 | --- stoqlib/chart/paymentcharts.py 2011-07-01 19:35:48 +0000 | |||
318 | +++ stoqlib/chart/paymentcharts.py 2011-11-05 17:07:26 +0000 | |||
319 | @@ -23,9 +23,11 @@ | |||
320 | 23 | ## | 23 | ## |
321 | 24 | """ Payment charts """ | 24 | """ Payment charts """ |
322 | 25 | 25 | ||
323 | 26 | import datetime | ||
324 | 26 | import string | 27 | import string |
325 | 27 | 28 | ||
326 | 28 | from stoqlib.chart.chart import Chart | 29 | from stoqlib.chart.chart import Chart |
327 | 30 | from stoqlib.database.runtime import get_connection | ||
328 | 29 | from stoqlib.lib.translation import stoqlib_gettext | 31 | from stoqlib.lib.translation import stoqlib_gettext |
329 | 30 | 32 | ||
330 | 31 | _ = stoqlib_gettext | 33 | _ = stoqlib_gettext |
331 | @@ -164,6 +166,7 @@ | |||
332 | 164 | @month: month to show payments for | 166 | @month: month to show payments for |
333 | 165 | @returns: (month, total in payments, total out payments, profit) | 167 | @returns: (month, total in payments, total out payments, profit) |
334 | 166 | """ | 168 | """ |
335 | 169 | conn = get_connection() | ||
336 | 167 | 170 | ||
337 | 168 | if 2100 > year < 1900: | 171 | if 2100 > year < 1900: |
338 | 169 | raise ValueError(year) | 172 | raise ValueError(year) |
339 | 170 | 173 | ||
340 | === modified file 'stoqlib/database/admin.py' | |||
341 | --- stoqlib/database/admin.py 2011-07-27 15:43:30 +0000 | |||
342 | +++ stoqlib/database/admin.py 2011-11-05 17:07:26 +0000 | |||
343 | @@ -236,10 +236,10 @@ | |||
344 | 236 | TaxType.NONE, | 236 | TaxType.NONE, |
345 | 237 | TaxType.SERVICE]: | 237 | TaxType.SERVICE]: |
346 | 238 | desc = describe_constant(enum) | 238 | desc = describe_constant(enum) |
351 | 239 | constant = SellableTaxConstant(description=desc, | 239 | SellableTaxConstant(description=desc, |
352 | 240 | tax_type=int(enum), | 240 | tax_type=int(enum), |
353 | 241 | tax_value=None, | 241 | tax_value=None, |
354 | 242 | connection=trans) | 242 | connection=trans) |
355 | 243 | 243 | ||
356 | 244 | trans.commit(close=True) | 244 | trans.commit(close=True) |
357 | 245 | 245 | ||
358 | 246 | 246 | ||
359 | === modified file 'stoqlib/database/database.py' | |||
360 | --- stoqlib/database/database.py 2011-10-26 17:46:38 +0000 | |||
361 | +++ stoqlib/database/database.py 2011-11-05 17:07:26 +0000 | |||
362 | @@ -38,7 +38,7 @@ | |||
363 | 38 | from stoqlib.database.exceptions import SQLError | 38 | from stoqlib.database.exceptions import SQLError |
364 | 39 | from stoqlib.database.interfaces import IDatabaseSettings | 39 | from stoqlib.database.interfaces import IDatabaseSettings |
365 | 40 | 40 | ||
367 | 41 | from stoqlib.lib.message import error, warning | 41 | from stoqlib.lib.message import warning |
368 | 42 | from stoqlib.lib.translation import stoqlib_gettext | 42 | from stoqlib.lib.translation import stoqlib_gettext |
369 | 43 | 43 | ||
370 | 44 | _ = stoqlib_gettext | 44 | _ = stoqlib_gettext |
371 | @@ -308,7 +308,7 @@ | |||
372 | 308 | log.debug('executing %s' % (' '.join(args), )) | 308 | log.debug('executing %s' % (' '.join(args), )) |
373 | 309 | 309 | ||
374 | 310 | proc = subprocess.Popen(args, stderr=subprocess.PIPE) | 310 | proc = subprocess.Popen(args, stderr=subprocess.PIPE) |
376 | 311 | retcode = proc.wait() | 311 | proc.wait() |
377 | 312 | return newname | 312 | return newname |
378 | 313 | else: | 313 | else: |
379 | 314 | raise NotImplementedError(settings.rdbms) | 314 | raise NotImplementedError(settings.rdbms) |
380 | 315 | 315 | ||
381 | === modified file 'stoqlib/database/migration.py' | |||
382 | --- stoqlib/database/migration.py 2011-11-01 01:13:11 +0000 | |||
383 | +++ stoqlib/database/migration.py 2011-11-05 17:07:26 +0000 | |||
384 | @@ -38,7 +38,6 @@ | |||
385 | 38 | 38 | ||
386 | 39 | from stoqlib.database.database import (execute_sql, dump_database, | 39 | from stoqlib.database.database import (execute_sql, dump_database, |
387 | 40 | restore_database, test_connection) | 40 | restore_database, test_connection) |
388 | 41 | from stoqlib.database.exceptions import SQLError | ||
389 | 42 | from stoqlib.database.runtime import new_transaction, get_connection | 41 | from stoqlib.database.runtime import new_transaction, get_connection |
390 | 43 | from stoqlib.domain.plugin import InstalledPlugin | 42 | from stoqlib.domain.plugin import InstalledPlugin |
391 | 44 | from stoqlib.domain.profile import update_profile_applications | 43 | from stoqlib.domain.profile import update_profile_applications |
392 | @@ -327,7 +326,7 @@ | |||
393 | 327 | super(StoqlibSchemaMigration, self).update() | 326 | super(StoqlibSchemaMigration, self).update() |
394 | 328 | if plugins: | 327 | if plugins: |
395 | 329 | self.update_plugins() | 328 | self.update_plugins() |
397 | 330 | except Exception, e: | 329 | except Exception: |
398 | 331 | exc = sys.exc_info() | 330 | exc = sys.exc_info() |
399 | 332 | tb_str = ''.join(traceback.format_exception(*exc)) | 331 | tb_str = ''.join(traceback.format_exception(*exc)) |
400 | 333 | collect_traceback(exc, submit=True) | 332 | collect_traceback(exc, submit=True) |
401 | 334 | 333 | ||
402 | === modified file 'stoqlib/database/runtime.py' | |||
403 | --- stoqlib/database/runtime.py 2011-10-28 15:04:24 +0000 | |||
404 | +++ stoqlib/database/runtime.py 2011-11-05 17:07:26 +0000 | |||
405 | @@ -32,7 +32,7 @@ | |||
406 | 32 | IDatabaseSettings, IConnection, ITransaction, ICurrentBranch, | 32 | IDatabaseSettings, IConnection, ITransaction, ICurrentBranch, |
407 | 33 | ICurrentBranchStation, ICurrentUser) | 33 | ICurrentBranchStation, ICurrentUser) |
408 | 34 | from stoqlib.database.orm import ORMObject, Transaction | 34 | from stoqlib.database.orm import ORMObject, Transaction |
410 | 35 | from stoqlib.database.orm import sqlIdentifier, const, Update, IN | 35 | from stoqlib.database.orm import sqlIdentifier, const |
411 | 36 | from stoqlib.exceptions import LoginError, StoqlibError | 36 | from stoqlib.exceptions import LoginError, StoqlibError |
412 | 37 | from stoqlib.lib.message import error, yesno | 37 | from stoqlib.lib.message import error, yesno |
413 | 38 | from stoqlib.lib.translation import stoqlib_gettext | 38 | from stoqlib.lib.translation import stoqlib_gettext |
414 | 39 | 39 | ||
415 | === modified file 'stoqlib/database/testsuite.py' | |||
416 | --- stoqlib/database/testsuite.py 2011-07-20 20:33:08 +0000 | |||
417 | +++ stoqlib/database/testsuite.py 2011-11-05 17:07:26 +0000 | |||
418 | @@ -216,7 +216,7 @@ | |||
419 | 216 | initialize_system() | 216 | initialize_system() |
420 | 217 | ensure_admin_user("") | 217 | ensure_admin_user("") |
421 | 218 | create(utilities=True) | 218 | create(utilities=True) |
423 | 219 | except Exception, e: | 219 | except Exception: |
424 | 220 | # Work around trial | 220 | # Work around trial |
425 | 221 | import traceback | 221 | import traceback |
426 | 222 | traceback.print_exc() | 222 | traceback.print_exc() |
427 | 223 | 223 | ||
428 | === modified file 'stoqlib/domain/address.py' | |||
429 | --- stoqlib/domain/address.py 2011-09-28 19:55:17 +0000 | |||
430 | +++ stoqlib/domain/address.py 2011-11-05 17:07:26 +0000 | |||
431 | @@ -25,7 +25,7 @@ | |||
432 | 25 | from kiwi.argcheck import argcheck | 25 | from kiwi.argcheck import argcheck |
433 | 26 | from zope.interface import implements | 26 | from zope.interface import implements |
434 | 27 | 27 | ||
436 | 28 | from stoqlib.database.orm import (AND, const, UnicodeCol, IntCol, ForeignKey, | 28 | from stoqlib.database.orm import (AND, UnicodeCol, IntCol, ForeignKey, |
437 | 29 | BoolCol, ILIKE) | 29 | BoolCol, ILIKE) |
438 | 30 | from stoqlib.database.runtime import StoqlibTransaction | 30 | from stoqlib.database.runtime import StoqlibTransaction |
439 | 31 | from stoqlib.domain.base import Domain | 31 | from stoqlib.domain.base import Domain |
440 | 32 | 32 | ||
441 | === modified file 'stoqlib/domain/base.py' | |||
442 | --- stoqlib/domain/base.py 2011-10-13 17:51:40 +0000 | |||
443 | +++ stoqlib/domain/base.py 2011-11-05 17:07:26 +0000 | |||
444 | @@ -26,7 +26,7 @@ | |||
445 | 26 | from zope.interface.interface import adapter_hooks | 26 | from zope.interface.interface import adapter_hooks |
446 | 27 | 27 | ||
447 | 28 | from stoqlib.database.orm import orm_name, ForeignKey, IntCol | 28 | from stoqlib.database.orm import orm_name, ForeignKey, IntCol |
449 | 29 | from stoqlib.database.orm import ORMObject, const, AND, const, ILIKE | 29 | from stoqlib.database.orm import ORMObject, const, AND, ILIKE |
450 | 30 | from stoqlib.database.runtime import (StoqlibTransaction, | 30 | from stoqlib.database.runtime import (StoqlibTransaction, |
451 | 31 | get_current_user, get_current_station) | 31 | get_current_user, get_current_station) |
452 | 32 | from stoqlib.domain.system import TransactionEntry | 32 | from stoqlib.domain.system import TransactionEntry |
453 | 33 | 33 | ||
454 | === modified file 'stoqlib/domain/devices.py' | |||
455 | --- stoqlib/domain/devices.py 2011-07-15 18:01:20 +0000 | |||
456 | +++ stoqlib/domain/devices.py 2011-11-05 17:07:26 +0000 | |||
457 | @@ -25,8 +25,6 @@ | |||
458 | 25 | Domain classes related to stoqdrivers package. | 25 | Domain classes related to stoqdrivers package. |
459 | 26 | """ | 26 | """ |
460 | 27 | 27 | ||
461 | 28 | import platform | ||
462 | 29 | |||
463 | 30 | from zope.interface import implements | 28 | from zope.interface import implements |
464 | 31 | from stoqdrivers.printers.cheque import ChequePrinter | 29 | from stoqdrivers.printers.cheque import ChequePrinter |
465 | 32 | from stoqdrivers.scales.scales import Scale | 30 | from stoqdrivers.scales.scales import Scale |
466 | 33 | 31 | ||
467 | === modified file 'stoqlib/domain/event.py' | |||
468 | --- stoqlib/domain/event.py 2011-10-29 20:25:07 +0000 | |||
469 | +++ stoqlib/domain/event.py 2011-11-05 17:07:26 +0000 | |||
470 | @@ -64,9 +64,9 @@ | |||
471 | 64 | @classmethod | 64 | @classmethod |
472 | 65 | def log(cls, event_type, description): | 65 | def log(cls, event_type, description): |
473 | 66 | trans = new_transaction() | 66 | trans = new_transaction() |
477 | 67 | event = cls(event_type=event_type, | 67 | cls(event_type=event_type, |
478 | 68 | description=description, | 68 | description=description, |
479 | 69 | connection=trans) | 69 | connection=trans) |
480 | 70 | trans.commit() | 70 | trans.commit() |
481 | 71 | 71 | ||
482 | 72 | 72 | ||
483 | 73 | 73 | ||
484 | === modified file 'stoqlib/domain/product.py' | |||
485 | --- stoqlib/domain/product.py 2011-10-27 19:50:12 +0000 | |||
486 | +++ stoqlib/domain/product.py 2011-11-05 17:07:26 +0000 | |||
487 | @@ -38,8 +38,7 @@ | |||
488 | 38 | from stoqlib.domain.events import (ProductCreateEvent, ProductEditEvent, | 38 | from stoqlib.domain.events import (ProductCreateEvent, ProductEditEvent, |
489 | 39 | ProductRemoveEvent, ProductStockUpdateEvent) | 39 | ProductRemoveEvent, ProductStockUpdateEvent) |
490 | 40 | from stoqlib.domain.person import Person | 40 | from stoqlib.domain.person import Person |
493 | 41 | from stoqlib.domain.interfaces import (IStorable, IContainer, | 41 | from stoqlib.domain.interfaces import IStorable, IBranch |
492 | 42 | IBranch) | ||
494 | 43 | from stoqlib.exceptions import StockError, DatabaseInconsistency | 42 | from stoqlib.exceptions import StockError, DatabaseInconsistency |
495 | 44 | from stoqlib.lib.translation import stoqlib_gettext | 43 | from stoqlib.lib.translation import stoqlib_gettext |
496 | 45 | from stoqlib.lib.parameters import sysparam | 44 | from stoqlib.lib.parameters import sysparam |
497 | 46 | 45 | ||
498 | === modified file 'stoqlib/domain/test/test_nfe.py' | |||
499 | --- stoqlib/domain/test/test_nfe.py 2011-11-01 01:13:11 +0000 | |||
500 | +++ stoqlib/domain/test/test_nfe.py 2011-11-05 17:07:26 +0000 | |||
501 | @@ -41,8 +41,7 @@ | |||
502 | 41 | 41 | ||
503 | 42 | # This test should be inside plugins/nfe, but it's not reachable there | 42 | # This test should be inside plugins/nfe, but it's not reachable there |
504 | 43 | sys.path.append('plugins/nfe') | 43 | sys.path.append('plugins/nfe') |
507 | 44 | from nfegenerator import (NFeGenerator, remove_accentuation, nfe_tostring, | 44 | from nfegenerator import NFeGenerator, remove_accentuation, NFeIdentification |
506 | 45 | NFeIdentification) | ||
508 | 46 | 45 | ||
509 | 47 | 46 | ||
510 | 48 | class TestNfeGenerator(DomainTest): | 47 | class TestNfeGenerator(DomainTest): |
511 | 49 | 48 | ||
512 | === modified file 'stoqlib/domain/test/test_person.py' | |||
513 | --- stoqlib/domain/test/test_person.py 2011-10-28 18:01:18 +0000 | |||
514 | +++ stoqlib/domain/test/test_person.py 2011-11-05 17:07:26 +0000 | |||
515 | @@ -27,8 +27,6 @@ | |||
516 | 27 | 27 | ||
517 | 28 | from kiwi.datatypes import currency | 28 | from kiwi.datatypes import currency |
518 | 29 | 29 | ||
519 | 30 | from twisted.trial.unittest import SkipTest | ||
520 | 31 | |||
521 | 32 | from stoqlib.database.orm import ORMObjectMoreThanOneResultError, AND | 30 | from stoqlib.database.orm import ORMObjectMoreThanOneResultError, AND |
522 | 33 | from stoqlib.domain.account import BankAccount | 31 | from stoqlib.domain.account import BankAccount |
523 | 34 | from stoqlib.domain.person import Calls, Liaison | 32 | from stoqlib.domain.person import Calls, Liaison |
524 | 35 | 33 | ||
525 | === modified file 'stoqlib/domain/test/test_sellable.py' | |||
526 | --- stoqlib/domain/test/test_sellable.py 2011-10-03 16:59:34 +0000 | |||
527 | +++ stoqlib/domain/test/test_sellable.py 2011-11-05 17:07:26 +0000 | |||
528 | @@ -369,7 +369,7 @@ | |||
529 | 369 | def testRemove(self): | 369 | def testRemove(self): |
530 | 370 | # Remove category price and sellable | 370 | # Remove category price and sellable |
531 | 371 | sellable = self.create_sellable() | 371 | sellable = self.create_sellable() |
533 | 372 | storable = sellable.product.addFacet(IStorable, connection=self.trans) | 372 | sellable.product.addFacet(IStorable, connection=self.trans) |
534 | 373 | 373 | ||
535 | 374 | ClientCategoryPrice(sellable=sellable, | 374 | ClientCategoryPrice(sellable=sellable, |
536 | 375 | category=self.create_client_category(), | 375 | category=self.create_client_category(), |
537 | 376 | 376 | ||
538 | === modified file 'stoqlib/gui/accounttree.py' | |||
539 | --- stoqlib/gui/accounttree.py 2011-08-08 19:18:15 +0000 | |||
540 | +++ stoqlib/gui/accounttree.py 2011-11-05 17:07:26 +0000 | |||
541 | @@ -22,7 +22,6 @@ | |||
542 | 22 | import gtk | 22 | import gtk |
543 | 23 | 23 | ||
544 | 24 | from kiwi.currency import currency | 24 | from kiwi.currency import currency |
545 | 25 | from kiwi.datatypes import converter | ||
546 | 26 | from kiwi.python import Settable | 25 | from kiwi.python import Settable |
547 | 27 | from kiwi.ui.objectlist import ColoredColumn, Column, ObjectTree | 26 | from kiwi.ui.objectlist import ColoredColumn, Column, ObjectTree |
548 | 28 | from stoqlib.database.runtime import get_connection | 27 | from stoqlib.database.runtime import get_connection |
549 | 29 | 28 | ||
550 | === modified file 'stoqlib/gui/base/lists.py' | |||
551 | --- stoqlib/gui/base/lists.py 2011-08-01 13:47:11 +0000 | |||
552 | +++ stoqlib/gui/base/lists.py 2011-11-05 17:07:26 +0000 | |||
553 | @@ -24,7 +24,6 @@ | |||
554 | 24 | """ List management for common dialogs. """ | 24 | """ List management for common dialogs. """ |
555 | 25 | 25 | ||
556 | 26 | import gtk | 26 | import gtk |
557 | 27 | from kiwi.ui.delegates import GladeSlaveDelegate | ||
558 | 28 | from kiwi.ui.objectlist import ObjectList | 27 | from kiwi.ui.objectlist import ObjectList |
559 | 29 | from kiwi.ui.listdialog import ListSlave | 28 | from kiwi.ui.listdialog import ListSlave |
560 | 30 | from kiwi.utils import gsignal | 29 | from kiwi.utils import gsignal |
561 | 31 | 30 | ||
562 | === modified file 'stoqlib/gui/dialogs/branchdialog.py' | |||
563 | --- stoqlib/gui/dialogs/branchdialog.py 2011-07-11 19:31:50 +0000 | |||
564 | +++ stoqlib/gui/dialogs/branchdialog.py 2011-11-05 17:07:26 +0000 | |||
565 | @@ -65,10 +65,6 @@ | |||
566 | 65 | BaseEditor.__init__(self, trans, model, visual_mode=False) | 65 | BaseEditor.__init__(self, trans, model, visual_mode=False) |
567 | 66 | self._setup_widgets() | 66 | self._setup_widgets() |
568 | 67 | 67 | ||
569 | 68 | def _setup_widgets(self): | ||
570 | 69 | self.title_label.set_size('large') | ||
571 | 70 | self.title_label.set_bold(True) | ||
572 | 71 | |||
573 | 72 | def _update_system_parameters(self, person): | 68 | def _update_system_parameters(self, person): |
574 | 73 | icms = self.tax_proxy.model.icms | 69 | icms = self.tax_proxy.model.icms |
575 | 74 | self.param.update_parameter('ICMS_TAX', unicode(icms)) | 70 | self.param.update_parameter('ICMS_TAX', unicode(icms)) |
576 | 75 | 71 | ||
577 | === modified file 'stoqlib/gui/dialogs/chartdialog.py' | |||
578 | --- stoqlib/gui/dialogs/chartdialog.py 2011-07-01 18:41:05 +0000 | |||
579 | +++ stoqlib/gui/dialogs/chartdialog.py 2011-11-05 17:07:26 +0000 | |||
580 | @@ -26,6 +26,8 @@ | |||
581 | 26 | import gtk | 26 | import gtk |
582 | 27 | import webkit | 27 | import webkit |
583 | 28 | 28 | ||
584 | 29 | from twisted.internet import reactor | ||
585 | 30 | |||
586 | 29 | class ChartDialog(gtk.Window): | 31 | class ChartDialog(gtk.Window): |
587 | 30 | def __init__(self): | 32 | def __init__(self): |
588 | 31 | gtk.Window.__init__(self) | 33 | gtk.Window.__init__(self) |
589 | 32 | 34 | ||
590 | === modified file 'stoqlib/gui/dialogs/productiondialog.py' | |||
591 | --- stoqlib/gui/dialogs/productiondialog.py 2011-10-28 17:21:28 +0000 | |||
592 | +++ stoqlib/gui/dialogs/productiondialog.py 2011-11-05 17:07:26 +0000 | |||
593 | @@ -24,7 +24,6 @@ | |||
594 | 24 | ## | 24 | ## |
595 | 25 | 25 | ||
596 | 26 | from decimal import Decimal | 26 | from decimal import Decimal |
597 | 27 | from sys import maxint as MAXINT | ||
598 | 28 | 27 | ||
599 | 29 | import gtk | 28 | import gtk |
600 | 30 | from gtk import gdk | 29 | from gtk import gdk |
601 | @@ -232,7 +231,6 @@ | |||
602 | 232 | self.remove_product_button.set_sensitive(can_remove) | 231 | self.remove_product_button.set_sensitive(can_remove) |
603 | 233 | 232 | ||
604 | 234 | def _get_columns(self): | 233 | def _get_columns(self): |
605 | 235 | adj = gtk.Adjustment(upper=MAXINT, step_incr=1) | ||
606 | 236 | return [Column('code', title=_(u'Code'), data_type=int), | 234 | return [Column('code', title=_(u'Code'), data_type=int), |
607 | 237 | Column('category', title=_(u'Category'), data_type=str, | 235 | Column('category', title=_(u'Category'), data_type=str, |
608 | 238 | expand=True, sorted=True), | 236 | expand=True, sorted=True), |
609 | @@ -312,7 +310,6 @@ | |||
610 | 312 | self.export_csv_button.set_sensitive(self.has_rows) | 310 | self.export_csv_button.set_sensitive(self.has_rows) |
611 | 313 | 311 | ||
612 | 314 | def _get_columns(self): | 312 | def _get_columns(self): |
613 | 315 | adj = gtk.Adjustment(upper=MAXINT, step_incr=1) | ||
614 | 316 | return [Column('industrialized_str', title=_(u'Ind.'), data_type=str), | 313 | return [Column('industrialized_str', title=_(u'Ind.'), data_type=str), |
615 | 317 | Column('code', title=_(u'code'), data_type=str), | 314 | Column('code', title=_(u'code'), data_type=str), |
616 | 318 | Column('category', title=_(u'Category'), data_type=str, | 315 | Column('category', title=_(u'Category'), data_type=str, |
617 | 319 | 316 | ||
618 | === modified file 'stoqlib/gui/dialogs/productionquotedialog.py' | |||
619 | --- stoqlib/gui/dialogs/productionquotedialog.py 2011-02-08 14:21:07 +0000 | |||
620 | +++ stoqlib/gui/dialogs/productionquotedialog.py 2011-11-05 17:07:26 +0000 | |||
621 | @@ -57,7 +57,6 @@ | |||
622 | 57 | order = self._create_purchase_order(trans) | 57 | order = self._create_purchase_order(trans) |
623 | 58 | to_quote_items = {} | 58 | to_quote_items = {} |
624 | 59 | for production in productions: | 59 | for production in productions: |
625 | 60 | materials = production.get_material_items() | ||
626 | 61 | for material in production.get_material_items(): | 60 | for material in production.get_material_items(): |
627 | 62 | if material.to_purchase <= 0: | 61 | if material.to_purchase <= 0: |
628 | 63 | continue | 62 | continue |
629 | 64 | 63 | ||
630 | === modified file 'stoqlib/gui/dialogs/purchasedetails.py' | |||
631 | --- stoqlib/gui/dialogs/purchasedetails.py 2011-07-12 19:35:02 +0000 | |||
632 | +++ stoqlib/gui/dialogs/purchasedetails.py 2011-11-05 17:07:26 +0000 | |||
633 | @@ -76,7 +76,6 @@ | |||
634 | 76 | 76 | ||
635 | 77 | if orders.count(): | 77 | if orders.count(): |
636 | 78 | discount = surcharge = freight = subtotal = total = 0 | 78 | discount = surcharge = freight = subtotal = total = 0 |
637 | 79 | freight_type = None | ||
638 | 80 | for order in orders: | 79 | for order in orders: |
639 | 81 | discount += order._get_total_discounts() | 80 | discount += order._get_total_discounts() |
640 | 82 | surcharge += order._get_total_surcharges() | 81 | surcharge += order._get_total_surcharges() |
641 | 83 | 82 | ||
642 | === modified file 'stoqlib/gui/editors/accounttransactioneditor.py' | |||
643 | --- stoqlib/gui/editors/accounttransactioneditor.py 2011-08-10 18:24:18 +0000 | |||
644 | +++ stoqlib/gui/editors/accounttransactioneditor.py 2011-11-05 17:07:26 +0000 | |||
645 | @@ -24,7 +24,6 @@ | |||
646 | 24 | 24 | ||
647 | 25 | import datetime | 25 | import datetime |
648 | 26 | 26 | ||
649 | 27 | import gobject | ||
650 | 28 | import gtk | 27 | import gtk |
651 | 29 | from kiwi.currency import currency | 28 | from kiwi.currency import currency |
652 | 30 | from kiwi.datatypes import ValidationError | 29 | from kiwi.datatypes import ValidationError |
653 | 31 | 30 | ||
654 | === modified file 'stoqlib/gui/editors/personeditor.py' | |||
655 | --- stoqlib/gui/editors/personeditor.py 2011-08-04 19:49:44 +0000 | |||
656 | +++ stoqlib/gui/editors/personeditor.py 2011-11-05 17:07:26 +0000 | |||
657 | @@ -44,7 +44,7 @@ | |||
658 | 44 | from stoqlib.domain.person import EmployeeRole, PersonAdaptToCreditProvider | 44 | from stoqlib.domain.person import EmployeeRole, PersonAdaptToCreditProvider |
659 | 45 | from stoqlib.domain.interfaces import (IClient, ICreditProvider, IEmployee, | 45 | from stoqlib.domain.interfaces import (IClient, ICreditProvider, IEmployee, |
660 | 46 | ISupplier, ITransporter, IUser, | 46 | ISupplier, ITransporter, IUser, |
662 | 47 | ICompany, IIndividual, IBranch) | 47 | IIndividual, IBranch) |
663 | 48 | 48 | ||
664 | 49 | _ = stoqlib_gettext | 49 | _ = stoqlib_gettext |
665 | 50 | 50 | ||
666 | 51 | 51 | ||
667 | === modified file 'stoqlib/gui/editors/profileeditor.py' | |||
668 | --- stoqlib/gui/editors/profileeditor.py 2011-09-28 19:55:17 +0000 | |||
669 | +++ stoqlib/gui/editors/profileeditor.py 2011-11-05 17:07:26 +0000 | |||
670 | @@ -28,8 +28,6 @@ | |||
671 | 28 | from kiwi.datatypes import ValidationError | 28 | from kiwi.datatypes import ValidationError |
672 | 29 | from kiwi.ui.widgets.checkbutton import ProxyCheckButton | 29 | from kiwi.ui.widgets.checkbutton import ProxyCheckButton |
673 | 30 | 30 | ||
674 | 31 | from stoqlib.database.orm import const, AND | ||
675 | 32 | from stoqlib.database.runtime import get_connection | ||
676 | 33 | from stoqlib.domain.profile import UserProfile, ProfileSettings | 31 | from stoqlib.domain.profile import UserProfile, ProfileSettings |
677 | 34 | from stoqlib.gui.editors.baseeditor import BaseEditor | 32 | from stoqlib.gui.editors.baseeditor import BaseEditor |
678 | 35 | from stoqlib.lib.interfaces import IApplicationDescriptions | 33 | from stoqlib.lib.interfaces import IApplicationDescriptions |
679 | 36 | 34 | ||
680 | === modified file 'stoqlib/gui/editors/sellableeditor.py' | |||
681 | --- stoqlib/gui/editors/sellableeditor.py 2011-10-03 16:59:34 +0000 | |||
682 | +++ stoqlib/gui/editors/sellableeditor.py 2011-11-05 17:07:26 +0000 | |||
683 | @@ -410,7 +410,6 @@ | |||
684 | 410 | def _update_tax_value(self): | 410 | def _update_tax_value(self): |
685 | 411 | if not hasattr(self, 'tax_proxy'): | 411 | if not hasattr(self, 'tax_proxy'): |
686 | 412 | return | 412 | return |
687 | 413 | constant = self.tax_constant.get_selected_data() | ||
688 | 414 | self.tax_proxy.update('tax_constant.tax_value') | 413 | self.tax_proxy.update('tax_constant.tax_value') |
689 | 415 | 414 | ||
690 | 416 | def get_taxes(self): | 415 | def get_taxes(self): |
691 | 417 | 416 | ||
692 | === modified file 'stoqlib/gui/editors/tilleditor.py' | |||
693 | --- stoqlib/gui/editors/tilleditor.py 2011-10-05 17:33:34 +0000 | |||
694 | +++ stoqlib/gui/editors/tilleditor.py 2011-11-05 17:07:26 +0000 | |||
695 | @@ -29,12 +29,12 @@ | |||
696 | 29 | from kiwi.python import Settable | 29 | from kiwi.python import Settable |
697 | 30 | from kiwi.ui.objectlist import Column, ColoredColumn, SummaryLabel | 30 | from kiwi.ui.objectlist import Column, ColoredColumn, SummaryLabel |
698 | 31 | 31 | ||
700 | 32 | from stoqdrivers.exceptions import CouponOpenError, DriverError | 32 | from stoqdrivers.exceptions import DriverError |
701 | 33 | 33 | ||
702 | 34 | from stoqlib.database.orm import const | 34 | from stoqlib.database.orm import const |
703 | 35 | from stoqlib.database.runtime import (get_current_station, new_transaction, | 35 | from stoqlib.database.runtime import (get_current_station, new_transaction, |
704 | 36 | finish_transaction) | 36 | finish_transaction) |
706 | 37 | from stoqlib.domain.account import Account, AccountTransaction | 37 | from stoqlib.domain.account import AccountTransaction |
707 | 38 | from stoqlib.domain.events import (TillOpenEvent, TillCloseEvent, | 38 | from stoqlib.domain.events import (TillOpenEvent, TillCloseEvent, |
708 | 39 | TillAddTillEntryEvent, | 39 | TillAddTillEntryEvent, |
709 | 40 | TillAddCashEvent, TillRemoveCashEvent) | 40 | TillAddCashEvent, TillRemoveCashEvent) |
710 | @@ -50,7 +50,6 @@ | |||
711 | 50 | _ = stoqlib_gettext | 50 | _ = stoqlib_gettext |
712 | 51 | 51 | ||
713 | 52 | def _create_transaction(conn, till_entry): | 52 | def _create_transaction(conn, till_entry): |
714 | 53 | till = till_entry.till | ||
715 | 54 | AccountTransaction(description=till_entry.description, | 53 | AccountTransaction(description=till_entry.description, |
716 | 55 | source_account=sysparam(conn).IMBALANCE_ACCOUNT, | 54 | source_account=sysparam(conn).IMBALANCE_ACCOUNT, |
717 | 56 | account=sysparam(conn).TILLS_ACCOUNT, | 55 | account=sysparam(conn).TILLS_ACCOUNT, |
718 | 57 | 56 | ||
719 | === modified file 'stoqlib/gui/fiscalprinter.py' | |||
720 | --- stoqlib/gui/fiscalprinter.py 2011-11-01 01:13:11 +0000 | |||
721 | +++ stoqlib/gui/fiscalprinter.py 2011-11-05 17:07:26 +0000 | |||
722 | @@ -54,8 +54,6 @@ | |||
723 | 54 | from stoqlib.lib.translation import stoqlib_gettext | 54 | from stoqlib.lib.translation import stoqlib_gettext |
724 | 55 | from stoqlib.gui.wizards.salewizard import ConfirmSaleWizard | 55 | from stoqlib.gui.wizards.salewizard import ConfirmSaleWizard |
725 | 56 | 56 | ||
726 | 57 | from stoqlib.domain.devices import FiscalDayHistory, FiscalDayTax | ||
727 | 58 | |||
728 | 59 | 57 | ||
729 | 60 | _ = stoqlib_gettext | 58 | _ = stoqlib_gettext |
730 | 61 | 59 | ||
731 | @@ -212,7 +210,7 @@ | |||
732 | 212 | 210 | ||
733 | 213 | try: | 211 | try: |
734 | 214 | CouponCreatedEvent.emit(coupon) | 212 | CouponCreatedEvent.emit(coupon) |
736 | 215 | except (DriverError, DeviceError), e: | 213 | except (DriverError, DeviceError): |
737 | 216 | warning('Não foi possível abrir o cupom') | 214 | warning('Não foi possível abrir o cupom') |
738 | 217 | coupon = None | 215 | coupon = None |
739 | 218 | 216 | ||
740 | 219 | 217 | ||
741 | === modified file 'stoqlib/gui/printing.py' | |||
742 | --- stoqlib/gui/printing.py 2011-10-03 14:12:38 +0000 | |||
743 | +++ stoqlib/gui/printing.py 2011-11-05 17:07:26 +0000 | |||
744 | @@ -207,30 +207,6 @@ | |||
745 | 207 | kwargs['filter_strings'] = filter_strings | 207 | kwargs['filter_strings'] = filter_strings |
746 | 208 | return kwargs | 208 | return kwargs |
747 | 209 | 209 | ||
748 | 210 | |||
749 | 211 | def print_report(report_class, *args, **kwargs): | ||
750 | 212 | if kwargs.has_key('filters') and kwargs['filters']: | ||
751 | 213 | kwargs = describe_search_filters_for_reports(**kwargs) | ||
752 | 214 | |||
753 | 215 | tmp = tempfile.mktemp(suffix='.pdf', prefix='stoqlib-reporting') | ||
754 | 216 | report = report_class(tmp, *args, **kwargs) | ||
755 | 217 | report.filename = tmp | ||
756 | 218 | report.save() | ||
757 | 219 | op = PrintOperation() | ||
758 | 220 | op.print_pdf(report) | ||
759 | 221 | |||
760 | 222 | def describe_search_filters_for_reports(**kwargs): | ||
761 | 223 | filters = kwargs.pop('filters') | ||
762 | 224 | filter_strings = [] | ||
763 | 225 | for filter in filters: | ||
764 | 226 | description = filter.get_description() | ||
765 | 227 | if description: | ||
766 | 228 | filter_strings.append(description) | ||
767 | 229 | |||
768 | 230 | kwargs['filter_strings'] = filter_strings | ||
769 | 231 | return kwargs | ||
770 | 232 | |||
771 | 233 | |||
772 | 234 | def print_report(report_class, *args, **kwargs): | 210 | def print_report(report_class, *args, **kwargs): |
773 | 235 | if kwargs.has_key('filters') and kwargs['filters']: | 211 | if kwargs.has_key('filters') and kwargs['filters']: |
774 | 236 | kwargs = describe_search_filters_for_reports(**kwargs) | 212 | kwargs = describe_search_filters_for_reports(**kwargs) |
775 | 237 | 213 | ||
776 | === modified file 'stoqlib/gui/search/eventsearch.py' | |||
777 | --- stoqlib/gui/search/eventsearch.py 2011-10-29 20:25:07 +0000 | |||
778 | +++ stoqlib/gui/search/eventsearch.py 2011-11-05 17:07:26 +0000 | |||
779 | @@ -24,8 +24,6 @@ | |||
780 | 24 | ## | 24 | ## |
781 | 25 | """ Implementation of event search """ | 25 | """ Implementation of event search """ |
782 | 26 | 26 | ||
783 | 27 | import datetime | ||
784 | 28 | |||
785 | 29 | from kiwi.ui.objectlist import Column | 27 | from kiwi.ui.objectlist import Column |
786 | 30 | 28 | ||
787 | 31 | from stoqlib.gui.base.search import SearchEditor | 29 | from stoqlib.gui.base.search import SearchEditor |
788 | 32 | 30 | ||
789 | === modified file 'stoqlib/gui/search/fiscalsearch.py' | |||
790 | --- stoqlib/gui/search/fiscalsearch.py 2011-07-14 17:15:00 +0000 | |||
791 | +++ stoqlib/gui/search/fiscalsearch.py 2011-11-05 17:07:26 +0000 | |||
792 | @@ -83,11 +83,9 @@ | |||
793 | 83 | searchbar_result_strings = _("fiscal entry"), _("fiscal entries") | 83 | searchbar_result_strings = _("fiscal entry"), _("fiscal entries") |
794 | 84 | 84 | ||
795 | 85 | def _setup_columns(self, column, table, col_name, summary_label_text): | 85 | def _setup_columns(self, column, table, col_name, summary_label_text): |
796 | 86 | label_text = '<b>%s</b>' % summary_label_text | ||
797 | 87 | columns = self.get_columns() + [column] | 86 | columns = self.get_columns() + [column] |
798 | 88 | self.results.set_columns(columns) | 87 | self.results.set_columns(columns) |
799 | 89 | self.set_table(table) | 88 | self.set_table(table) |
800 | 90 | #self.setup_summary_label(col_name, label_text) | ||
801 | 91 | 89 | ||
802 | 92 | def _setup_icms_columns(self): | 90 | def _setup_icms_columns(self): |
803 | 93 | col = SearchColumn('icms_value', | 91 | col = SearchColumn('icms_value', |
804 | 94 | 92 | ||
805 | === modified file 'stoqlib/gui/slaves/employeeslave.py' | |||
806 | --- stoqlib/gui/slaves/employeeslave.py 2011-02-08 14:06:58 +0000 | |||
807 | +++ stoqlib/gui/slaves/employeeslave.py 2011-11-05 17:07:26 +0000 | |||
808 | @@ -207,11 +207,8 @@ | |||
809 | 207 | 207 | ||
810 | 208 | def _update_sensitivity(self): | 208 | def _update_sensitivity(self): |
811 | 209 | editor = True | 209 | editor = True |
812 | 210 | settings = False | ||
813 | 211 | if self.role.get_text(): | 210 | if self.role.get_text(): |
814 | 212 | editor = self.role.is_valid() | 211 | editor = self.role.is_valid() |
815 | 213 | if editor: | ||
816 | 214 | settings = self._is_default_salesperson_role() | ||
817 | 215 | else: | 212 | else: |
818 | 216 | self.model.role = None | 213 | self.model.role = None |
819 | 217 | self.role_editor_button.set_sensitive(editor) | 214 | self.role_editor_button.set_sensitive(editor) |
820 | 218 | 215 | ||
821 | === modified file 'stoqlib/gui/slaves/paymentmethodslave.py' | |||
822 | --- stoqlib/gui/slaves/paymentmethodslave.py 2011-08-05 16:54:09 +0000 | |||
823 | +++ stoqlib/gui/slaves/paymentmethodslave.py 2011-11-05 17:07:26 +0000 | |||
824 | @@ -28,10 +28,8 @@ | |||
825 | 28 | from kiwi.ui.delegates import GladeSlaveDelegate | 28 | from kiwi.ui.delegates import GladeSlaveDelegate |
826 | 29 | from kiwi.utils import gsignal | 29 | from kiwi.utils import gsignal |
827 | 30 | 30 | ||
828 | 31 | from stoqlib.database.runtime import get_connection | ||
829 | 32 | from stoqlib.domain.payment.views import PaymentMethodView | 31 | from stoqlib.domain.payment.views import PaymentMethodView |
830 | 33 | from stoqlib.exceptions import StoqlibError | 32 | from stoqlib.exceptions import StoqlibError |
831 | 34 | from stoqlib.lib.message import marker | ||
832 | 35 | from stoqlib.lib.translation import stoqlib_gettext | 33 | from stoqlib.lib.translation import stoqlib_gettext |
833 | 36 | 34 | ||
834 | 37 | N_ = _ = stoqlib_gettext | 35 | N_ = _ = stoqlib_gettext |
835 | 38 | 36 | ||
836 | === modified file 'stoqlib/gui/slaves/userslave.py' | |||
837 | --- stoqlib/gui/slaves/userslave.py 2011-09-28 19:55:17 +0000 | |||
838 | +++ stoqlib/gui/slaves/userslave.py 2011-11-05 17:07:26 +0000 | |||
839 | @@ -29,10 +29,9 @@ | |||
840 | 29 | import gtk | 29 | import gtk |
841 | 30 | from kiwi.datatypes import ValidationError | 30 | from kiwi.datatypes import ValidationError |
842 | 31 | 31 | ||
843 | 32 | from stoqlib.database.orm import const | ||
844 | 33 | from stoqlib.database.runtime import get_current_user | 32 | from stoqlib.database.runtime import get_current_user |
845 | 34 | from stoqlib.domain.profile import UserProfile | 33 | from stoqlib.domain.profile import UserProfile |
847 | 35 | from stoqlib.domain.person import EmployeeRole, Person | 34 | from stoqlib.domain.person import EmployeeRole |
848 | 36 | from stoqlib.domain.interfaces import IEmployee, ISalesPerson, IUser | 35 | from stoqlib.domain.interfaces import IEmployee, ISalesPerson, IUser |
849 | 37 | from stoqlib.gui.editors.baseeditor import BaseEditor, BaseEditorSlave | 36 | from stoqlib.gui.editors.baseeditor import BaseEditor, BaseEditorSlave |
850 | 38 | from stoqlib.gui.base.dialogs import run_dialog | 37 | from stoqlib.gui.base.dialogs import run_dialog |
851 | 39 | 38 | ||
852 | === modified file 'stoqlib/gui/splash.py' | |||
853 | --- stoqlib/gui/splash.py 2011-06-29 20:21:26 +0000 | |||
854 | +++ stoqlib/gui/splash.py 2011-11-05 17:07:26 +0000 | |||
855 | @@ -27,7 +27,6 @@ | |||
856 | 27 | import time | 27 | import time |
857 | 28 | 28 | ||
858 | 29 | import gobject | 29 | import gobject |
859 | 30 | import cairo | ||
860 | 31 | import gtk | 30 | import gtk |
861 | 32 | import pango | 31 | import pango |
862 | 33 | import pangocairo | 32 | import pangocairo |
863 | 34 | 33 | ||
864 | === modified file 'stoqlib/gui/templates/individualtemplate.py' | |||
865 | --- stoqlib/gui/templates/individualtemplate.py 2011-06-21 13:31:33 +0000 | |||
866 | +++ stoqlib/gui/templates/individualtemplate.py 2011-11-05 17:07:26 +0000 | |||
867 | @@ -140,7 +140,6 @@ | |||
868 | 140 | self.birth_state.prefill(get_country_states()) | 140 | self.birth_state.prefill(get_country_states()) |
869 | 141 | 141 | ||
870 | 142 | def _update_marital_status(self): | 142 | def _update_marital_status(self): |
871 | 143 | marital_status = self.marital_status.get_selected_data() | ||
872 | 144 | if self.model.is_married(): | 143 | if self.model.is_married(): |
873 | 145 | self.spouse_lbl.show() | 144 | self.spouse_lbl.show() |
874 | 146 | self.spouse_name.show() | 145 | self.spouse_name.show() |
875 | 147 | 146 | ||
876 | === modified file 'stoqlib/gui/wizards/purchasewizard.py' | |||
877 | --- stoqlib/gui/wizards/purchasewizard.py 2011-11-04 12:06:43 +0000 | |||
878 | +++ stoqlib/gui/wizards/purchasewizard.py 2011-11-05 17:07:26 +0000 | |||
879 | @@ -25,7 +25,6 @@ | |||
880 | 25 | """ Purchase wizard definition """ | 25 | """ Purchase wizard definition """ |
881 | 26 | 26 | ||
882 | 27 | import datetime | 27 | import datetime |
883 | 28 | from decimal import Decimal | ||
884 | 29 | import sys | 28 | import sys |
885 | 30 | 29 | ||
886 | 31 | import gtk | 30 | import gtk |
887 | @@ -38,7 +37,7 @@ | |||
888 | 38 | from stoqlib.domain.interfaces import IBranch, ITransporter, ISupplier | 37 | from stoqlib.domain.interfaces import IBranch, ITransporter, ISupplier |
889 | 39 | from stoqlib.domain.payment.group import PaymentGroup | 38 | from stoqlib.domain.payment.group import PaymentGroup |
890 | 40 | from stoqlib.domain.payment.operation import register_payment_operations | 39 | from stoqlib.domain.payment.operation import register_payment_operations |
892 | 41 | from stoqlib.domain.person import Person, PersonAdaptToTransporter | 40 | from stoqlib.domain.person import Person |
893 | 42 | from stoqlib.domain.product import ProductSupplierInfo | 41 | from stoqlib.domain.product import ProductSupplierInfo |
894 | 43 | from stoqlib.domain.purchase import PurchaseOrder, PurchaseItem | 42 | from stoqlib.domain.purchase import PurchaseOrder, PurchaseItem |
895 | 44 | from stoqlib.domain.receiving import (ReceivingOrder, ReceivingOrderItem, | 43 | from stoqlib.domain.receiving import (ReceivingOrder, ReceivingOrderItem, |
896 | 45 | 44 | ||
897 | === modified file 'stoqlib/importers/branchimporter.py' | |||
898 | --- stoqlib/importers/branchimporter.py 2011-02-08 14:06:58 +0000 | |||
899 | +++ stoqlib/importers/branchimporter.py 2011-11-05 17:07:26 +0000 | |||
900 | @@ -62,13 +62,16 @@ | |||
901 | 62 | state=data.state, | 62 | state=data.state, |
902 | 63 | country=data.country) | 63 | country=data.country) |
903 | 64 | streetnumber = data.streetnumber and int(data.streetnumber) or None | 64 | streetnumber = data.streetnumber and int(data.streetnumber) or None |
911 | 65 | address = Address(is_main_address=True, | 65 | Address( |
912 | 66 | person=person, city_location=ctloc, | 66 | is_main_address=True, |
913 | 67 | connection=trans, | 67 | person=person, |
914 | 68 | street=data.street, | 68 | city_location=ctloc, |
915 | 69 | streetnumber=streetnumber, | 69 | connection=trans, |
916 | 70 | district=data.district, | 70 | street=data.street, |
917 | 71 | postal_code=data.postal_code) | 71 | streetnumber=streetnumber, |
918 | 72 | district=data.district, | ||
919 | 73 | postal_code=data.postal_code | ||
920 | 74 | ) | ||
921 | 72 | 75 | ||
922 | 73 | person.addFacet(IBranch, connection=trans) | 76 | person.addFacet(IBranch, connection=trans) |
923 | 74 | 77 | ||
924 | 75 | 78 | ||
925 | === modified file 'stoqlib/importers/clientimporter.py' | |||
926 | --- stoqlib/importers/clientimporter.py 2011-02-08 14:06:58 +0000 | |||
927 | +++ stoqlib/importers/clientimporter.py 2011-11-05 17:07:26 +0000 | |||
928 | @@ -59,11 +59,14 @@ | |||
929 | 59 | state=data.state, | 59 | state=data.state, |
930 | 60 | country=data.country) | 60 | country=data.country) |
931 | 61 | streetnumber = data.streetnumber and int(data.streetnumber) or None | 61 | streetnumber = data.streetnumber and int(data.streetnumber) or None |
938 | 62 | address = Address(is_main_address=True, | 62 | Address( |
939 | 63 | person=person, city_location=ctloc, | 63 | is_main_address=True, |
940 | 64 | connection=trans, | 64 | person=person, |
941 | 65 | street=data.street, | 65 | city_location=ctloc, |
942 | 66 | streetnumber=streetnumber, | 66 | connection=trans, |
943 | 67 | district=data.district) | 67 | street=data.street, |
944 | 68 | streetnumber=streetnumber, | ||
945 | 69 | district=data.district | ||
946 | 70 | ) | ||
947 | 68 | 71 | ||
948 | 69 | person.addFacet(IClient, connection=trans) | 72 | person.addFacet(IClient, connection=trans) |
949 | 70 | 73 | ||
950 | === modified file 'stoqlib/importers/creditproviderimporter.py' | |||
951 | --- stoqlib/importers/creditproviderimporter.py 2011-02-08 14:06:58 +0000 | |||
952 | +++ stoqlib/importers/creditproviderimporter.py 2011-11-05 17:07:26 +0000 | |||
953 | @@ -64,12 +64,13 @@ | |||
954 | 64 | state=data.state, | 64 | state=data.state, |
955 | 65 | country=data.country) | 65 | country=data.country) |
956 | 66 | streetnumber = data.streetnumber and int(data.streetnumber) or None | 66 | streetnumber = data.streetnumber and int(data.streetnumber) or None |
963 | 67 | address = Address(is_main_address=True, | 67 | Address(is_main_address=True, |
964 | 68 | person=person, city_location=ctloc, | 68 | person=person, |
965 | 69 | connection=trans, | 69 | city_location=ctloc, |
966 | 70 | street=data.street, | 70 | connection=trans, |
967 | 71 | streetnumber=streetnumber, | 71 | street=data.street, |
968 | 72 | district=data.district) | 72 | streetnumber=streetnumber, |
969 | 73 | district=data.district) | ||
970 | 73 | 74 | ||
971 | 74 | person.addFacet(ICreditProvider, connection=trans, | 75 | person.addFacet(ICreditProvider, connection=trans, |
972 | 75 | open_contract_date=const.NOW(), | 76 | open_contract_date=const.NOW(), |
973 | 76 | 77 | ||
974 | === modified file 'stoqlib/importers/csvimporter.py' | |||
975 | --- stoqlib/importers/csvimporter.py 2011-07-15 19:57:51 +0000 | |||
976 | +++ stoqlib/importers/csvimporter.py 2011-11-05 17:07:26 +0000 | |||
977 | @@ -73,9 +73,6 @@ | |||
978 | 73 | # | 73 | # |
979 | 74 | 74 | ||
980 | 75 | def feed(self, fp, filename='<stdin>'): | 75 | def feed(self, fp, filename='<stdin>'): |
981 | 76 | field_names = self.fields + self.optional_fields | ||
982 | 77 | |||
983 | 78 | t = time.time() | ||
984 | 79 | trans = new_transaction() | 76 | trans = new_transaction() |
985 | 80 | self.before_start(trans) | 77 | self.before_start(trans) |
986 | 81 | trans.commit(close=True) | 78 | trans.commit(close=True) |
987 | @@ -86,6 +83,7 @@ | |||
988 | 86 | return len(self.rows) | 83 | return len(self.rows) |
989 | 87 | 84 | ||
990 | 88 | def process_item(self, trans, item_no): | 85 | def process_item(self, trans, item_no): |
991 | 86 | t = time.time() | ||
992 | 89 | item = self.rows[item_no] | 87 | item = self.rows[item_no] |
993 | 90 | if not item or item[0].startswith('%'): | 88 | if not item or item[0].startswith('%'): |
994 | 91 | self.lineno += 1 | 89 | self.lineno += 1 |
995 | @@ -106,7 +104,7 @@ | |||
996 | 106 | row = CSVRow(item, field_names) | 104 | row = CSVRow(item, field_names) |
997 | 107 | try: | 105 | try: |
998 | 108 | self.process_one(row, row.fields, trans) | 106 | self.process_one(row, row.fields, trans) |
1000 | 109 | except Exception, e: | 107 | except Exception: |
1001 | 110 | 108 | ||
1002 | 111 | print 'Error while processing row %d %r' % (self.lineno, row,) | 109 | print 'Error while processing row %d %r' % (self.lineno, row,) |
1003 | 112 | 110 | ||
1004 | 113 | 111 | ||
1005 | === modified file 'stoqlib/importers/employeeimporter.py' | |||
1006 | --- stoqlib/importers/employeeimporter.py 2011-02-08 14:06:58 +0000 | |||
1007 | +++ stoqlib/importers/employeeimporter.py 2011-11-05 17:07:26 +0000 | |||
1008 | @@ -72,7 +72,7 @@ | |||
1009 | 72 | registry_number=data.employee_number) | 72 | registry_number=data.employee_number) |
1010 | 73 | 73 | ||
1011 | 74 | start = self.parse_date(data.start) | 74 | start = self.parse_date(data.start) |
1013 | 75 | role_history = EmployeeRoleHistory( | 75 | EmployeeRoleHistory( |
1014 | 76 | connection=trans, role=role, | 76 | connection=trans, role=role, |
1015 | 77 | employee=employee, | 77 | employee=employee, |
1016 | 78 | is_active=True, | 78 | is_active=True, |
1017 | @@ -84,12 +84,13 @@ | |||
1018 | 84 | state=data.state, | 84 | state=data.state, |
1019 | 85 | country=data.country) | 85 | country=data.country) |
1020 | 86 | streetnumber = data.streetnumber and int(data.streetnumber) or None | 86 | streetnumber = data.streetnumber and int(data.streetnumber) or None |
1027 | 87 | address = Address(is_main_address=True, | 87 | Address(is_main_address=True, |
1028 | 88 | person=person, city_location=ctloc, | 88 | person=person, |
1029 | 89 | connection=trans, | 89 | city_location=ctloc, |
1030 | 90 | street=data.street, | 90 | connection=trans, |
1031 | 91 | streetnumber=streetnumber, | 91 | street=data.street, |
1032 | 92 | district=data.district) | 92 | streetnumber=streetnumber, |
1033 | 93 | district=data.district) | ||
1034 | 93 | 94 | ||
1035 | 94 | profile = UserProfile.selectOneBy(name=data.profile, connection=trans) | 95 | profile = UserProfile.selectOneBy(name=data.profile, connection=trans) |
1036 | 95 | 96 | ||
1037 | 96 | 97 | ||
1038 | === modified file 'stoqlib/importers/ofximporter.py' | |||
1039 | --- stoqlib/importers/ofximporter.py 2011-07-19 19:18:46 +0000 | |||
1040 | +++ stoqlib/importers/ofximporter.py 2011-11-05 17:07:26 +0000 | |||
1041 | @@ -201,7 +201,6 @@ | |||
1042 | 201 | value=value, | 201 | value=value, |
1043 | 202 | date=date, | 202 | date=date, |
1044 | 203 | connection=trans) | 203 | connection=trans) |
1045 | 204 | last_date = date | ||
1046 | 205 | t.sync() | 204 | t.sync() |
1047 | 206 | return True | 205 | return True |
1048 | 207 | 206 | ||
1049 | 208 | 207 | ||
1050 | === modified file 'stoqlib/importers/purchaseimporter.py' | |||
1051 | --- stoqlib/importers/purchaseimporter.py 2011-02-08 14:21:07 +0000 | |||
1052 | +++ stoqlib/importers/purchaseimporter.py 2011-11-05 17:07:26 +0000 | |||
1053 | @@ -102,10 +102,12 @@ | |||
1054 | 102 | connection=trans) | 102 | connection=trans) |
1055 | 103 | 103 | ||
1056 | 104 | for purchase_item in purchase.get_items(): | 104 | for purchase_item in purchase.get_items(): |
1063 | 105 | receicing_item = ReceivingOrderItem(connection=trans, | 105 | ReceivingOrderItem( |
1064 | 106 | cost=purchase_item.sellable.cost, | 106 | connection=trans, |
1065 | 107 | sellable=purchase_item.sellable, | 107 | cost=purchase_item.sellable.cost, |
1066 | 108 | quantity=int(data.quantity), | 108 | sellable=purchase_item.sellable, |
1067 | 109 | purchase_item=purchase_item, | 109 | quantity=int(data.quantity), |
1068 | 110 | receiving_order=receiving_order) | 110 | purchase_item=purchase_item, |
1069 | 111 | receiving_order=receiving_order | ||
1070 | 112 | ) | ||
1071 | 111 | receiving_order.confirm() | 113 | receiving_order.confirm() |
1072 | 112 | 114 | ||
1073 | === modified file 'stoqlib/importers/serviceimporter.py' | |||
1074 | --- stoqlib/importers/serviceimporter.py 2011-06-21 13:31:33 +0000 | |||
1075 | +++ stoqlib/importers/serviceimporter.py 2011-11-05 17:07:26 +0000 | |||
1076 | @@ -57,5 +57,5 @@ | |||
1077 | 57 | cost=int(data.cost), | 57 | cost=int(data.cost), |
1078 | 58 | code=data.barcode, | 58 | code=data.barcode, |
1079 | 59 | barcode=data.barcode) | 59 | barcode=data.barcode) |
1082 | 60 | service = Service(sellable=sellable, | 60 | Service(sellable=sellable, |
1083 | 61 | connection=trans) | 61 | connection=trans) |
1084 | 62 | 62 | ||
1085 | === modified file 'stoqlib/importers/supplierimporter.py' | |||
1086 | --- stoqlib/importers/supplierimporter.py 2011-02-08 14:06:58 +0000 | |||
1087 | +++ stoqlib/importers/supplierimporter.py 2011-11-05 17:07:26 +0000 | |||
1088 | @@ -61,12 +61,15 @@ | |||
1089 | 61 | state=data.state, | 61 | state=data.state, |
1090 | 62 | country=data.country) | 62 | country=data.country) |
1091 | 63 | streetnumber = data.streetnumber and int(data.streetnumber) or None | 63 | streetnumber = data.streetnumber and int(data.streetnumber) or None |
1098 | 64 | address = Address(is_main_address=True, | 64 | Address( |
1099 | 65 | person=person, city_location=ctloc, | 65 | is_main_address=True, |
1100 | 66 | connection=trans, | 66 | person=person, |
1101 | 67 | street=data.street, | 67 | city_location=ctloc, |
1102 | 68 | streetnumber=streetnumber, | 68 | connection=trans, |
1103 | 69 | district=data.district) | 69 | street=data.street, |
1104 | 70 | streetnumber=streetnumber, | ||
1105 | 71 | district=data.district | ||
1106 | 72 | ) | ||
1107 | 70 | 73 | ||
1108 | 71 | person.addFacet(ISupplier, connection=trans) | 74 | person.addFacet(ISupplier, connection=trans) |
1109 | 72 | 75 | ||
1110 | 73 | 76 | ||
1111 | === modified file 'stoqlib/importers/transporterimporter.py' | |||
1112 | --- stoqlib/importers/transporterimporter.py 2011-06-21 13:31:33 +0000 | |||
1113 | +++ stoqlib/importers/transporterimporter.py 2011-11-05 17:07:26 +0000 | |||
1114 | @@ -62,12 +62,15 @@ | |||
1115 | 62 | state=data.state, | 62 | state=data.state, |
1116 | 63 | country=data.country) | 63 | country=data.country) |
1117 | 64 | streetnumber = data.streetnumber and int(data.streetnumber) or None | 64 | streetnumber = data.streetnumber and int(data.streetnumber) or None |
1124 | 65 | address = Address(is_main_address=True, | 65 | Address( |
1125 | 66 | person=person, city_location=ctloc, | 66 | is_main_address=True, |
1126 | 67 | connection=trans, | 67 | person=person, |
1127 | 68 | street=data.street, | 68 | city_location=ctloc, |
1128 | 69 | streetnumber=streetnumber, | 69 | connection=trans, |
1129 | 70 | district=data.district) | 70 | street=data.street, |
1130 | 71 | streetnumber=streetnumber, | ||
1131 | 72 | district=data.district | ||
1132 | 73 | ) | ||
1133 | 71 | 74 | ||
1134 | 72 | dict(open_contract_date=self.parse_date(data.open_contract), | 75 | dict(open_contract_date=self.parse_date(data.open_contract), |
1135 | 73 | freight_percentage=data.freight_percentage), | 76 | freight_percentage=data.freight_percentage), |
1136 | 74 | 77 | ||
1137 | === modified file 'stoqlib/lib/devicemanager.py' | |||
1138 | --- stoqlib/lib/devicemanager.py 2011-04-18 21:23:31 +0000 | |||
1139 | +++ stoqlib/lib/devicemanager.py 2011-11-05 17:07:26 +0000 | |||
1140 | @@ -30,6 +30,7 @@ | |||
1141 | 30 | 30 | ||
1142 | 31 | try: | 31 | try: |
1143 | 32 | import gudev | 32 | import gudev |
1144 | 33 | gudev # pyflakes | ||
1145 | 33 | except ImportError: | 34 | except ImportError: |
1146 | 34 | gudev = None | 35 | gudev = None |
1147 | 35 | 36 | ||
1148 | 36 | 37 | ||
1149 | === modified file 'stoqlib/lib/imageutils.py' | |||
1150 | --- stoqlib/lib/imageutils.py 2011-09-12 20:14:28 +0000 | |||
1151 | +++ stoqlib/lib/imageutils.py 2011-11-05 17:07:26 +0000 | |||
1152 | @@ -31,8 +31,6 @@ | |||
1153 | 31 | import gtk | 31 | import gtk |
1154 | 32 | import gobject | 32 | import gobject |
1155 | 33 | 33 | ||
1156 | 34 | from kiwi.environ import environ | ||
1157 | 35 | |||
1158 | 36 | 34 | ||
1159 | 37 | class ImageHelper(object): | 35 | class ImageHelper(object): |
1160 | 38 | 36 | ||
1161 | 39 | 37 | ||
1162 | === modified file 'stoqlib/lib/test/test_ofximporter.py' | |||
1163 | --- stoqlib/lib/test/test_ofximporter.py 2011-06-17 17:11:48 +0000 | |||
1164 | +++ stoqlib/lib/test/test_ofximporter.py 2011-11-05 17:07:26 +0000 | |||
1165 | @@ -24,11 +24,9 @@ | |||
1166 | 24 | from decimal import Decimal | 24 | from decimal import Decimal |
1167 | 25 | import operator | 25 | import operator |
1168 | 26 | 26 | ||
1169 | 27 | from stoqlib.database.runtime import new_transaction | ||
1170 | 28 | from stoqlib.domain.account import Account | 27 | from stoqlib.domain.account import Account |
1171 | 29 | from stoqlib.domain.test.domaintest import DomainTest | 28 | from stoqlib.domain.test.domaintest import DomainTest |
1172 | 30 | from stoqlib.importers.ofximporter import OFXImporter | 29 | from stoqlib.importers.ofximporter import OFXImporter |
1173 | 31 | from stoqlib.lib.parameters import sysparam | ||
1174 | 32 | 30 | ||
1175 | 33 | 31 | ||
1176 | 34 | OFX_DATA = """OFXHEADER:100 | 32 | OFX_DATA = """OFXHEADER:100 |
1177 | @@ -218,7 +216,6 @@ | |||
1178 | 218 | ofx.feed(StringIO(OFX_DATA)) | 216 | ofx.feed(StringIO(OFX_DATA)) |
1179 | 219 | ofx.set_dry(True) | 217 | ofx.set_dry(True) |
1180 | 220 | ofx.process(self.trans) | 218 | ofx.process(self.trans) |
1181 | 221 | imbalance_account = sysparam(self.trans).IMBALANCE_ACCOUNT | ||
1182 | 222 | account = Account.select(connection=self.trans).orderBy('id')[-1] | 219 | account = Account.select(connection=self.trans).orderBy('id')[-1] |
1183 | 223 | self.failUnless(account) | 220 | self.failUnless(account) |
1184 | 224 | self.assertEquals(account.description, "Bank - CHECKING") | 221 | self.assertEquals(account.description, "Bank - CHECKING") |
1185 | @@ -236,7 +233,6 @@ | |||
1186 | 236 | ofx.feed(StringIO(OFX_DATA2)) | 233 | ofx.feed(StringIO(OFX_DATA2)) |
1187 | 237 | ofx.set_dry(True) | 234 | ofx.set_dry(True) |
1188 | 238 | ofx.process(self.trans) | 235 | ofx.process(self.trans) |
1189 | 239 | imbalance_account = sysparam(self.trans).IMBALANCE_ACCOUNT | ||
1190 | 240 | account = Account.select(connection=self.trans).orderBy('id')[-1] | 236 | account = Account.select(connection=self.trans).orderBy('id')[-1] |
1191 | 241 | self.failUnless(account) | 237 | self.failUnless(account) |
1192 | 242 | self.assertEquals(account.description, "Banco do Brasil - CHECKING") | 238 | self.assertEquals(account.description, "Banco do Brasil - CHECKING") |
1193 | @@ -254,8 +250,6 @@ | |||
1194 | 254 | ofx.feed(StringIO(OFX_DATA3)) | 250 | ofx.feed(StringIO(OFX_DATA3)) |
1195 | 255 | ofx.set_dry(True) | 251 | ofx.set_dry(True) |
1196 | 256 | ofx.process(self.trans) | 252 | ofx.process(self.trans) |
1197 | 257 | imbalance_account = sysparam(self.trans).IMBALANCE_ACCOUNT | ||
1198 | 258 | trans = new_transaction() | ||
1199 | 259 | account = Account.select(connection=self.trans).orderBy('id')[-1] | 253 | account = Account.select(connection=self.trans).orderBy('id')[-1] |
1200 | 260 | self.failUnless(account) | 254 | self.failUnless(account) |
1201 | 261 | self.assertEquals(account.description, "SANTANDER - CHECKING") | 255 | self.assertEquals(account.description, "SANTANDER - CHECKING") |
1202 | 262 | 256 | ||
1203 | === modified file 'stoqlib/lib/test/test_parameters.py' | |||
1204 | --- stoqlib/lib/test/test_parameters.py 2011-06-17 20:40:14 +0000 | |||
1205 | +++ stoqlib/lib/test/test_parameters.py 2011-11-05 17:07:26 +0000 | |||
1206 | @@ -46,11 +46,11 @@ | |||
1207 | 46 | person = Person(name='Jonas', connection=self.trans) | 46 | person = Person(name='Jonas', connection=self.trans) |
1208 | 47 | person.addFacet(IIndividual, connection=self.trans) | 47 | person.addFacet(IIndividual, connection=self.trans) |
1209 | 48 | role = EmployeeRole(connection=self.trans, name='desenvolvedor') | 48 | role = EmployeeRole(connection=self.trans, name='desenvolvedor') |
1212 | 49 | employee = person.addFacet(IEmployee, connection=self.trans, | 49 | person.addFacet(IEmployee, connection=self.trans, |
1213 | 50 | role=role) | 50 | role=role) |
1214 | 51 | self.salesperson = person.addFacet(ISalesPerson, | 51 | self.salesperson = person.addFacet(ISalesPerson, |
1215 | 52 | connection=self.trans) | 52 | connection=self.trans) |
1217 | 53 | company = person.addFacet(ICompany, connection=self.trans) | 53 | person.addFacet(ICompany, connection=self.trans) |
1218 | 54 | client = person.addFacet(IClient, connection=self.trans) | 54 | client = person.addFacet(IClient, connection=self.trans) |
1219 | 55 | self.branch = person.addFacet(IBranch, connection=self.trans) | 55 | self.branch = person.addFacet(IBranch, connection=self.trans) |
1220 | 56 | 56 | ||
1221 | @@ -100,7 +100,6 @@ | |||
1222 | 100 | 100 | ||
1223 | 101 | def testUseLogicQuantity(self): | 101 | def testUseLogicQuantity(self): |
1224 | 102 | storable = self.create_storable() | 102 | storable = self.create_storable() |
1225 | 103 | param = self.sparam.USE_LOGIC_QUANTITY | ||
1226 | 104 | self.assertEqual(storable._check_logic_quantity(), None) | 103 | self.assertEqual(storable._check_logic_quantity(), None) |
1227 | 105 | self.sparam.update_parameter(parameter_name='USE_LOGIC_QUANTITY', | 104 | self.sparam.update_parameter(parameter_name='USE_LOGIC_QUANTITY', |
1228 | 106 | value=u'0') | 105 | value=u'0') |
1229 | 107 | 106 | ||
1230 | === modified file 'stoqlib/lib/test/test_sintegra.py' | |||
1231 | --- stoqlib/lib/test/test_sintegra.py 2008-10-01 16:11:05 +0000 | |||
1232 | +++ stoqlib/lib/test/test_sintegra.py 2011-11-05 17:07:26 +0000 | |||
1233 | @@ -20,7 +20,6 @@ | |||
1234 | 20 | ## Foundation, Inc., or visit: http://www.gnu.org/. | 20 | ## Foundation, Inc., or visit: http://www.gnu.org/. |
1235 | 21 | ## | 21 | ## |
1236 | 22 | 22 | ||
1237 | 23 | from cStringIO import StringIO | ||
1238 | 24 | import datetime | 23 | import datetime |
1239 | 25 | from decimal import Decimal | 24 | from decimal import Decimal |
1240 | 26 | import os | 25 | import os |
1241 | @@ -40,7 +39,6 @@ | |||
1242 | 40 | expected = basename + '-expected.txt' | 39 | expected = basename + '-expected.txt' |
1243 | 41 | output = basename + '-output.txt' | 40 | output = basename + '-output.txt' |
1244 | 42 | 41 | ||
1245 | 43 | fp = StringIO() | ||
1246 | 44 | sfile.write(output) | 42 | sfile.write(output) |
1247 | 45 | expected = os.path.join(test.__path__[0], expected) | 43 | expected = os.path.join(test.__path__[0], expected) |
1248 | 46 | retval = diff_files(expected, output) | 44 | retval = diff_files(expected, output) |
1249 | 47 | 45 | ||
1250 | === modified file 'stoqlib/lib/test/test_sintegragenerator.py' | |||
1251 | --- stoqlib/lib/test/test_sintegragenerator.py 2011-02-08 14:21:07 +0000 | |||
1252 | +++ stoqlib/lib/test/test_sintegragenerator.py 2011-11-05 17:07:26 +0000 | |||
1253 | @@ -77,8 +77,8 @@ | |||
1254 | 77 | sale.order() | 77 | sale.order() |
1255 | 78 | 78 | ||
1256 | 79 | method = PaymentMethod.get_by_name(self.trans, 'money') | 79 | method = PaymentMethod.get_by_name(self.trans, 'money') |
1259 | 80 | payment = method.create_inpayment(sale.group, | 80 | method.create_inpayment(sale.group, |
1260 | 81 | sale.get_sale_subtotal()) | 81 | sale.get_sale_subtotal()) |
1261 | 82 | 82 | ||
1262 | 83 | sale.confirm() | 83 | sale.confirm() |
1263 | 84 | sale.set_paid() | 84 | sale.set_paid() |
1264 | 85 | 85 | ||
1265 | === modified file 'stoqlib/lib/xmlrpc.py' | |||
1266 | --- stoqlib/lib/xmlrpc.py 2011-09-12 18:10:48 +0000 | |||
1267 | +++ stoqlib/lib/xmlrpc.py 2011-11-05 17:07:26 +0000 | |||
1268 | @@ -62,7 +62,7 @@ | |||
1269 | 62 | try: | 62 | try: |
1270 | 63 | exc = namedAny(exc_name) | 63 | exc = namedAny(exc_name) |
1271 | 64 | raise exc(msg) | 64 | raise exc(msg) |
1273 | 65 | except Exception, unused: | 65 | except Exception: |
1274 | 66 | # In case server/client side is out of sync | 66 | # In case server/client side is out of sync |
1275 | 67 | raise Exception(msg) | 67 | raise Exception(msg) |
1276 | 68 | 68 | ||
1277 | 69 | 69 | ||
1278 | === modified file 'stoqlib/reporting/product.py' | |||
1279 | --- stoqlib/reporting/product.py 2011-07-11 17:33:47 +0000 | |||
1280 | +++ stoqlib/reporting/product.py 2011-11-05 17:07:26 +0000 | |||
1281 | @@ -26,7 +26,6 @@ | |||
1282 | 26 | 26 | ||
1283 | 27 | from decimal import Decimal | 27 | from decimal import Decimal |
1284 | 28 | 28 | ||
1285 | 29 | from stoqlib.database.runtime import get_connection, get_current_branch | ||
1286 | 30 | from stoqlib.reporting.template import (SearchResultsReport, PriceReport, | 29 | from stoqlib.reporting.template import (SearchResultsReport, PriceReport, |
1287 | 31 | ObjectListReport) | 30 | ObjectListReport) |
1288 | 32 | from stoqlib.reporting.base.tables import ObjectTableColumn as OTC | 31 | from stoqlib.reporting.base.tables import ObjectTableColumn as OTC |
1289 | 33 | 32 | ||
1290 | === modified file 'stoqlib/reporting/purchase.py' | |||
1291 | --- stoqlib/reporting/purchase.py 2011-10-17 19:36:32 +0000 | |||
1292 | +++ stoqlib/reporting/purchase.py 2011-11-05 17:07:26 +0000 | |||
1293 | @@ -277,7 +277,6 @@ | |||
1294 | 277 | table_line=TABLE_LINE_BLANK, width=730) | 277 | table_line=TABLE_LINE_BLANK, width=730) |
1295 | 278 | 278 | ||
1296 | 279 | def _setup_items_table(self): | 279 | def _setup_items_table(self): |
1297 | 280 | items = self._order.get_items() | ||
1298 | 281 | # XXX: Stoqlib Reporting try to apply len() on the table data, but | 280 | # XXX: Stoqlib Reporting try to apply len() on the table data, but |
1299 | 282 | # Purchase's get_items returns a SelectResult instance (ORMObject) | 281 | # Purchase's get_items returns a SelectResult instance (ORMObject) |
1300 | 283 | # that not supports the len operator. | 282 | # that not supports the len operator. |
1301 | 284 | 283 | ||
1302 | === modified file 'stoqlib/reporting/sale.py' | |||
1303 | --- stoqlib/reporting/sale.py 2011-07-26 13:53:02 +0000 | |||
1304 | +++ stoqlib/reporting/sale.py 2011-11-05 17:07:26 +0000 | |||
1305 | @@ -324,8 +324,6 @@ | |||
1306 | 324 | if total_amount: | 324 | if total_amount: |
1307 | 325 | va = total_amount/sales_qty | 325 | va = total_amount/sales_qty |
1308 | 326 | text = _("Sold value per sales %s") % (get_formatted_price(va,)) | 326 | text = _("Sold value per sales %s") % (get_formatted_price(va,)) |
1309 | 327 | total_sellables = sum([item.sale.get_items_total_quantity() | ||
1310 | 328 | for item in self.salesperson_list]) | ||
1311 | 329 | 327 | ||
1312 | 330 | self.add_object_table(self.salesperson_list, self._get_columns(), | 328 | self.add_object_table(self.salesperson_list, self._get_columns(), |
1313 | 331 | summary_row=summary_row) | 329 | summary_row=summary_row) |
1314 | 332 | 330 | ||
1315 | === modified file 'stoqlib/reporting/template.py' | |||
1316 | --- stoqlib/reporting/template.py 2011-07-11 17:33:47 +0000 | |||
1317 | +++ stoqlib/reporting/template.py 2011-11-05 17:07:26 +0000 | |||
1318 | @@ -379,7 +379,6 @@ | |||
1319 | 379 | """ | 379 | """ |
1320 | 380 | conn = get_connection() | 380 | conn = get_connection() |
1321 | 381 | branch = get_current_branch(conn) | 381 | branch = get_current_branch(conn) |
1322 | 382 | branch_address = branch.person.address | ||
1323 | 383 | logo = _get_logotype_path(conn) | 382 | logo = _get_logotype_path(conn) |
1324 | 384 | 383 | ||
1325 | 385 | ns['title'] = self.title | 384 | ns['title'] = self.title |
1326 | 386 | 385 | ||
1327 | === modified file 'stoqlib/reporting/tests/test_reporting.py' | |||
1328 | --- stoqlib/reporting/tests/test_reporting.py 2011-11-05 16:46:12 +0000 | |||
1329 | +++ stoqlib/reporting/tests/test_reporting.py 2011-11-05 17:07:26 +0000 | |||
1330 | @@ -271,18 +271,18 @@ | |||
1331 | 271 | storable = product.addFacet(IStorable, connection=self.trans) | 271 | storable = product.addFacet(IStorable, connection=self.trans) |
1332 | 272 | storable.increase_stock(100, get_current_branch(self.trans)) | 272 | storable.increase_stock(100, get_current_branch(self.trans)) |
1333 | 273 | 273 | ||
1338 | 274 | source = CommissionSource(sellable=sellable, | 274 | CommissionSource(sellable=sellable, |
1339 | 275 | direct_value=Decimal(10), | 275 | direct_value=Decimal(10), |
1340 | 276 | installments_value=1, | 276 | installments_value=1, |
1341 | 277 | connection=self.trans) | 277 | connection=self.trans) |
1342 | 278 | 278 | ||
1343 | 279 | sale.order() | 279 | sale.order() |
1344 | 280 | 280 | ||
1345 | 281 | method = PaymentMethod.get_by_name(self.trans, 'money') | 281 | method = PaymentMethod.get_by_name(self.trans, 'money') |
1346 | 282 | till = Till.get_last_opened(self.trans) | 282 | till = Till.get_last_opened(self.trans) |
1350 | 283 | payment = method.create_inpayment(sale.group, | 283 | method.create_inpayment(sale.group, |
1351 | 284 | sale.get_sale_subtotal(), | 284 | sale.get_sale_subtotal(), |
1352 | 285 | till=till) | 285 | till=till) |
1353 | 286 | sale.confirm() | 286 | sale.confirm() |
1354 | 287 | sale.set_paid() | 287 | sale.set_paid() |
1355 | 288 | 288 | ||
1356 | 289 | 289 | ||
1357 | === added file 'stoqlib/test/test_pyflakes.py' | |||
1358 | --- stoqlib/test/test_pyflakes.py 1970-01-01 00:00:00 +0000 | |||
1359 | +++ stoqlib/test/test_pyflakes.py 2011-11-05 17:07:26 +0000 | |||
1360 | @@ -0,0 +1,68 @@ | |||
1361 | 1 | # -*- coding: utf-8 -*- | ||
1362 | 2 | # vi:si:et:sw=4:sts=4:ts=4 | ||
1363 | 3 | |||
1364 | 4 | ## | ||
1365 | 5 | ## Copyright (C) 2011 Async Open Source <http://www.async.com.br> | ||
1366 | 6 | ## All rights reserved | ||
1367 | 7 | ## | ||
1368 | 8 | ## This program is free software; you can redistribute it and/or modify | ||
1369 | 9 | ## it under the terms of the GNU General Public License as published by | ||
1370 | 10 | ## the Free Software Foundation; either version 2 of the License, or | ||
1371 | 11 | ## (at your option) any later version. | ||
1372 | 12 | ## | ||
1373 | 13 | ## This program is distributed in the hope that it will be useful, | ||
1374 | 14 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1375 | 15 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1376 | 16 | ## GNU General Public License for more details. | ||
1377 | 17 | ## | ||
1378 | 18 | ## You should have received a copy of the GNU General Public License | ||
1379 | 19 | ## along with this program; if not, write to the Free Software | ||
1380 | 20 | ## Foundation, Inc., or visit: http://www.gnu.org/. | ||
1381 | 21 | ## | ||
1382 | 22 | ## Author(s): Stoq Team <stoq-devel@async.com.br> | ||
1383 | 23 | ## | ||
1384 | 24 | """Test pyflakes on stoq, stoqlib and plugins directories | ||
1385 | 25 | |||
1386 | 26 | Useful to early find syntax errors and other common problems. | ||
1387 | 27 | """ | ||
1388 | 28 | |||
1389 | 29 | import sys | ||
1390 | 30 | import os.path | ||
1391 | 31 | |||
1392 | 32 | from twisted.trial import unittest | ||
1393 | 33 | try: | ||
1394 | 34 | from pyflakes.scripts import pyflakes | ||
1395 | 35 | pyflakes # pyflakes (ironique ah?) | ||
1396 | 36 | except ImportError: | ||
1397 | 37 | pyflakes = None | ||
1398 | 38 | |||
1399 | 39 | |||
1400 | 40 | class TestPyflakes(unittest.TestCase): | ||
1401 | 41 | |||
1402 | 42 | def __init__(self, *args, **kwargs): | ||
1403 | 43 | super(TestPyflakes, self).__init__(*args, **kwargs) | ||
1404 | 44 | |||
1405 | 45 | def _test_path(self, path_name): | ||
1406 | 46 | # Skip test if user doesn't have pyflakes installed. | ||
1407 | 47 | if not pyflakes: | ||
1408 | 48 | raise unittest.SkipTest("Pyflakes not installed") | ||
1409 | 49 | |||
1410 | 50 | test_path = None | ||
1411 | 51 | for path in sys.path: | ||
1412 | 52 | if path.endswith('stoq'): | ||
1413 | 53 | test_path = path | ||
1414 | 54 | break | ||
1415 | 55 | self.assertTrue(test_path) | ||
1416 | 56 | |||
1417 | 57 | path = os.path.join(test_path, path_name) | ||
1418 | 58 | retval = pyflakes.main([path]) | ||
1419 | 59 | self.assertEqual(retval, 0) | ||
1420 | 60 | |||
1421 | 61 | |||
1422 | 62 | for subpath in ('stoq', 'stoqlib', 'plugins'): | ||
1423 | 63 | # subpath has to be passed as a kw, or it will always be plugins (the | ||
1424 | 64 | # last subpath variable on for). | ||
1425 | 65 | func = lambda self, subpath=subpath: self._test_path(subpath) | ||
1426 | 66 | name = 'test_%s_pyflakes' % (subpath,) | ||
1427 | 67 | func.__name__ = name | ||
1428 | 68 | setattr(TestPyflakes, name, func) |
muito legal,era isso faz tempo. nem olhei direito ms acredito que vale pena
comitar como esta. proximo passo seria pep8.py, mas isso vai ser bem mais
trabalhoso.
bom trabalho thiago
On Tuesday, November 1, 2011, Thiago Bellini <email address hidden> /code.launchpad .net/~hackedbel lini/stoq/ pyflakes_ improvements/ +merge/ 80917 /code.launchpad .net/~hackedbel lini/stoq/ pyflakes_ improvements/ +merge/ 80917
wrote:
> Thiago Bellini has proposed merging
lp:~hackedbellini/stoq/pyflakes_improvements into lp:stoq.
>
> Requested reviews:
> Ronaldo Maia (romaia)
>
> For more details, see:
>
https:/
>
> Correções do Pyflakes e adição de testes.
>
> * Corrigi vários erros e warnings de pyflakes pelo código (stoq, stoqlib
e plugins).
> * Alguns lugares a correção é estranha, como a remoção de um método
inteiro. Esses casos era porque esse método estava sendo redefinido em
baixo, logo não estava sendo usado. Até mesmo alguns erros de variáveis não
definidas foram resolvidos. (o caso do charts, onde adicionei um XXX,
aquela classe pelo log tem apenas a implementação inicial e lá mesmo diz
que ela não funciona).
> * Adicionei testes para testar pyflakes em stoq, stoqlib e plugins. Vai
ser EXTREMAMENTE ÚTIL para encontrar erros de syntax que cometemos as
vezes, e podem acabar despercebidos até um usuário chamar aquela função.
>
> Não fiz nenhuma mudança funcional no código, apenas correções de pyflakes
mesmo! Rodei os testes sem STOQLIB_TEST_QUICK e testei a gui em várias
partes para ter certeza de que tudo ainda estava dentro dos conformes.
> --
>
https:/
> You are subscribed to branch lp:stoq.
>
--
Johan Dahlin