Merge lp:~bellini666/stoq/pyflakes_improvements into lp:~stoq-dev/stoq/master

Proposed by Thiago Bellini
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
Reviewer Review Type Date Requested Status
Ronaldo Maia Pending
Review via email: mp+80917@code.launchpad.net

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.

To post a comment you must log in.
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

Revision history for this message
Johan Dahlin (jdahlin-deactivatedaccount) wrote :

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>
wrote:
> Thiago Bellini has proposed merging
lp:~hackedbellini/stoq/pyflakes_improvements into lp:stoq.
>
> Requested reviews:
> Ronaldo Maia (romaia)
>
> For more details, see:
>
https://code.launchpad.net/~hackedbellini/stoq/pyflakes_improvements/+merge/80917
>
> 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://code.launchpad.net/~hackedbellini/stoq/pyflakes_improvements/+merge/80917
> You are subscribed to branch lp:stoq.
>

--
Johan Dahlin

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.

Revision history for this message
Thiago Bellini (bellini666) wrote :

Johan: Valeu :) Vou comitar então

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Makefile'
--- Makefile 2011-07-11 03:30:12 +0000
+++ Makefile 2011-11-05 17:07:26 +0000
@@ -29,7 +29,7 @@
29 pep8 stoq stoqlib29 pep8 stoq stoqlib
3030
31pyflakes:31pyflakes:
32 pyflakes stoq stoqlib32 pyflakes stoq stoqlib plugins
3333
34check:34check:
35 LC_ALL=C trial stoq stoqlib35 LC_ALL=C trial stoq stoqlib
3636
=== modified file 'plugins/books/bookssearch.py'
--- plugins/books/bookssearch.py 2011-05-19 17:52:30 +0000
+++ plugins/books/bookssearch.py 2011-11-05 17:07:26 +0000
@@ -32,7 +32,6 @@
3232
33from stoqlib.domain.sellable import Sellable33from stoqlib.domain.sellable import Sellable
34from stoqlib.gui.search.productsearch import ProductSearch34from stoqlib.gui.search.productsearch import ProductSearch
35from stoqlib.lib.defaults import sort_sellable_code
36from stoqlib.lib.translation import stoqlib_gettext as _35from stoqlib.lib.translation import stoqlib_gettext as _
37from stoqlib.lib.formatters import format_quantity, get_formatted_cost36from stoqlib.lib.formatters import format_quantity, get_formatted_cost
3837
3938
=== modified file 'plugins/books/booksslave.py'
--- plugins/books/booksslave.py 2011-02-08 14:06:58 +0000
+++ plugins/books/booksslave.py 2011-11-05 17:07:26 +0000
@@ -30,10 +30,7 @@
30from kiwi.datatypes import ValidationError30from kiwi.datatypes import ValidationError
3131
32from stoqlib.gui.editors.baseeditor import BaseEditorSlave32from stoqlib.gui.editors.baseeditor import BaseEditorSlave
33from stoqlib.gui.slaves.sellableslave import SellableDetailsSlave
34from stoqlib.domain.interfaces import IStorable
35from stoqlib.domain.person import Person33from stoqlib.domain.person import Person
36from stoqlib.domain.product import Product
37from stoqlib.lib.countries import get_countries34from stoqlib.lib.countries import get_countries
38from stoqlib.lib.translation import stoqlib_gettext35from stoqlib.lib.translation import stoqlib_gettext
3936
4037
=== modified file 'plugins/books/booksui.py'
--- plugins/books/booksui.py 2011-02-08 14:06:58 +0000
+++ plugins/books/booksui.py 2011-11-05 17:07:26 +0000
@@ -22,8 +22,6 @@
22## Author(s): Stoq Team <stoq-devel@async.com.br>22## Author(s): Stoq Team <stoq-devel@async.com.br>
23##23##
2424
25import os
26
27import gtk25import gtk
2826
29from kiwi.log import Logger27from kiwi.log import Logger
@@ -31,7 +29,6 @@
31from stoqlib.database.runtime import get_connection29from stoqlib.database.runtime import get_connection
32from stoqlib.gui.base.dialogs import run_dialog30from stoqlib.gui.base.dialogs import run_dialog
33from stoqlib.gui.events import StartApplicationEvent31from stoqlib.gui.events import StartApplicationEvent
34from stoqlib.lib.message import info
35from stoqlib.lib.translation import stoqlib_gettext32from stoqlib.lib.translation import stoqlib_gettext
3633
37from bookssearch import ProductBookSearch34from bookssearch import ProductBookSearch
3835
=== modified file 'plugins/books/publishersearch.py'
--- plugins/books/publishersearch.py 2011-05-19 17:52:30 +0000
+++ plugins/books/publishersearch.py 2011-11-05 17:07:26 +0000
@@ -24,17 +24,10 @@
2424
25""" Search dialog/Editor for publishers """25""" Search dialog/Editor for publishers """
2626
27from kiwi.argcheck import argcheck27from kiwi.ui.objectlist import SearchColumn
28from kiwi.enums import SearchFilterPosition
29from kiwi.ui.search import ComboSearchFilter
30from kiwi.ui.objectlist import Column, SearchColumn
3128
32from stoqlib.database.runtime import new_transaction
33from stoqlib.lib.translation import stoqlib_gettext29from stoqlib.lib.translation import stoqlib_gettext
34from stoqlib.lib.formatters import format_phone_number
3530
36from stoqlib.gui.base.search import SearchEditor, SearchDialog
37from stoqlib.gui.base.dialogs import run_dialog
38from stoqlib.gui.search.personsearch import BasePersonSearch31from stoqlib.gui.search.personsearch import BasePersonSearch
39from stoqlib.gui.templates.persontemplate import BasePersonRoleEditor32from stoqlib.gui.templates.persontemplate import BasePersonRoleEditor
4033
4134
=== modified file 'plugins/ecf/ecfui.py'
--- plugins/ecf/ecfui.py 2011-10-05 19:46:41 +0000
+++ plugins/ecf/ecfui.py 2011-11-05 17:07:26 +0000
@@ -55,7 +55,6 @@
55from couponprinter import CouponPrinter55from couponprinter import CouponPrinter
56from ecfdomain import ECFPrinter, FiscalSaleHistory56from ecfdomain import ECFPrinter, FiscalSaleHistory
57from ecfprinterdialog import ECFListDialog57from ecfprinterdialog import ECFListDialog
58from ecfprinterstatus import ECFAsyncPrinterStatus
59from ecfmemorydialog import FiscalMemoryDialog58from ecfmemorydialog import FiscalMemoryDialog
60from paulistainvoicedialog import PaulistaInvoiceDialog59from paulistainvoicedialog import PaulistaInvoiceDialog
6160
@@ -104,9 +103,6 @@
104 _("This operation requires a connected fiscal printer"))103 _("This operation requires a connected fiscal printer"))
105104
106 if not self._printer_verified:105 if not self._printer_verified:
107 domain = self._printer.get_printer()
108 driver = self._printer.get_driver()
109
110 if not self._printer.check_serial():106 if not self._printer.check_serial():
111 raise DeviceError(107 raise DeviceError(
112 _("Fiscalprinters serial number is different!"))108 _("Fiscalprinters serial number is different!"))
@@ -198,7 +194,7 @@
198 log.info('ecfui._check_printer')194 log.info('ecfui._check_printer')
199 try:195 try:
200 self._validate_printer()196 self._validate_printer()
201 except (DriverError, DeviceError), details:197 except (DriverError, DeviceError):
202 warning('Não foi possível comunicar com a impressora.')198 warning('Não foi possível comunicar com a impressora.')
203 raise SystemExit199 raise SystemExit
204200
205201
=== modified file 'plugins/ecf/tests/test_device.py'
--- plugins/ecf/tests/test_device.py 2011-06-21 13:31:33 +0000
+++ plugins/ecf/tests/test_device.py 2011-11-05 17:07:26 +0000
@@ -85,7 +85,6 @@
85 settings = self.create_ecf_printer()85 settings = self.create_ecf_printer()
86 settings.create_fiscal_printer_constants()86 settings.create_fiscal_printer_constants()
8787
88 constants = list(settings.constants)
89 for constant_type in [DeviceConstant.TYPE_UNIT,88 for constant_type in [DeviceConstant.TYPE_UNIT,
90 DeviceConstant.TYPE_TAX,89 DeviceConstant.TYPE_TAX,
91 DeviceConstant.TYPE_PAYMENT]:90 DeviceConstant.TYPE_PAYMENT]:
9291
=== modified file 'plugins/nfe/nfegenerator.py'
--- plugins/nfe/nfegenerator.py 2011-10-27 16:07:50 +0000
+++ plugins/nfe/nfegenerator.py 2011-11-05 17:07:26 +0000
@@ -30,9 +30,6 @@
30from xml.etree.ElementTree import Element30from xml.etree.ElementTree import Element
31from xml.sax.saxutils import escape31from xml.sax.saxutils import escape
3232
33from stoqdrivers.enum import TaxType
34
35import stoqlib
36from stoqlib.domain.interfaces import ICompany, IIndividual33from stoqlib.domain.interfaces import ICompany, IIndividual
37from stoqlib.exceptions import ModelDataError34from stoqlib.exceptions import ModelDataError
38from stoqlib.lib.parameters import sysparam35from stoqlib.lib.parameters import sysparam
@@ -449,7 +446,6 @@
449 def as_txt(self):446 def as_txt(self):
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'),
451 self.get_id_value())448 self.get_id_value())
452 children = self.get_children()
453 for child in self.get_children():449 for child in self.get_children():
454 txt += child.as_txt()450 txt += child.as_txt()
455451
@@ -1599,7 +1595,6 @@
15991595
1600 address = person.get_main_address()1596 address = person.get_main_address()
1601 if address:1597 if address:
1602 postal_code = ''.join([i for i in address.postal_code if i in '1234567890'])
1603 self.set_attr('xEnder', address.get_address_string()[:60])1598 self.set_attr('xEnder', address.get_address_string()[:60])
1604 self.set_attr('xMun', address.city_location.city[:60])1599 self.set_attr('xMun', address.city_location.city[:60])
1605 self.set_attr('UF', address.city_location.state)1600 self.set_attr('UF', address.city_location.state)
16061601
=== modified file 'plugins/nfe/nfeui.py'
--- plugins/nfe/nfeui.py 2011-10-19 19:44:32 +0000
+++ plugins/nfe/nfeui.py 2011-11-05 17:07:26 +0000
@@ -31,7 +31,6 @@
31from stoqlib.domain.sale import Sale31from stoqlib.domain.sale import Sale
32from stoqlib.gui.events import StartApplicationEvent32from stoqlib.gui.events import StartApplicationEvent
33from stoqlib.lib.osutils import get_application_dir33from stoqlib.lib.osutils import get_application_dir
34from stoqlib.lib.message import info
35from stoqlib.lib.translation import stoqlib_gettext34from stoqlib.lib.translation import stoqlib_gettext
3635
37from nfegenerator import NFeGenerator36from nfegenerator import NFeGenerator
3837
=== modified file 'stoq/dbadmin.py'
--- stoq/dbadmin.py 2011-11-01 01:13:11 +0000
+++ stoq/dbadmin.py 2011-11-05 17:07:26 +0000
@@ -192,10 +192,10 @@
192 branch = None192 branch = None
193193
194 try:194 try:
195 station = BranchStation(connection=trans,195 BranchStation(connection=trans,
196 is_active=True,196 is_active=True,
197 branch=branch,197 branch=branch,
198 name=socket.gethostname())198 name=socket.gethostname())
199 except StoqlibError, e:199 except StoqlibError, e:
200 raise SystemExit("ERROR: %s" % e)200 raise SystemExit("ERROR: %s" % e)
201201
202202
=== modified file 'stoq/gui/pos.py'
--- stoq/gui/pos.py 2011-11-01 01:13:11 +0000
+++ stoq/gui/pos.py 2011-11-05 17:07:26 +0000
@@ -511,7 +511,6 @@
511 self.set_sensitive([self.advanced_search], has_quantity)511 self.set_sensitive([self.advanced_search], has_quantity)
512512
513 def _read_quantity(self):513 def _read_quantity(self):
514 quantity_text = self.quantity.get_text()
515 try:514 try:
516 quantity = self.quantity.read()515 quantity = self.quantity.read()
517 except ValidationError:516 except ValidationError:
518517
=== modified file 'stoq/gui/receivable.py'
--- stoq/gui/receivable.py 2011-10-24 13:53:17 +0000
+++ stoq/gui/receivable.py 2011-11-05 17:07:26 +0000
@@ -35,7 +35,7 @@
35from kiwi.datatypes import currency35from kiwi.datatypes import currency
36from kiwi.enums import SearchFilterPosition36from kiwi.enums import SearchFilterPosition
37from kiwi.python import all37from kiwi.python import all
38from kiwi.ui.search import ComboSearchFilter, DateSearchOption38from kiwi.ui.search import ComboSearchFilter
39from kiwi.ui.objectlist import SearchColumn, Column39from kiwi.ui.objectlist import SearchColumn, Column
40from stoqlib.database.runtime import new_transaction, finish_transaction40from stoqlib.database.runtime import new_transaction, finish_transaction
41from stoqlib.domain.payment.operation import register_payment_operations41from stoqlib.domain.payment.operation import register_payment_operations
@@ -64,24 +64,6 @@
6464
65_ = gettext.gettext65_ = gettext.gettext
6666
67class NextMonthOption(DateSearchOption):
68 name = _('Next month')
69 def get_interval(self):
70 today = datetime.date.today()
71 year = today.year
72 month = today.month + 1
73 if month > 12:
74 month = 1
75 year += 1
76 # Try 31 first then add one until date() does not complain.
77 day = today.day
78 while True:
79 try:
80 end_date = datetime.date(year, month, day)
81 break
82 except ValueError:
83 day += 1
84 return datetime.date.today(), end_date
8567
86class ReceivableApp(SearchableAppWindow):68class ReceivableApp(SearchableAppWindow):
8769
8870
=== modified file 'stoq/gui/stock.py'
--- stoq/gui/stock.py 2011-10-04 16:01:38 +0000
+++ stoq/gui/stock.py 2011-11-05 17:07:26 +0000
@@ -41,7 +41,6 @@
41from stoqlib.domain.sellable import Sellable41from stoqlib.domain.sellable import Sellable
42from stoqlib.domain.views import ProductFullStockView42from stoqlib.domain.views import ProductFullStockView
43from stoqlib.lib.defaults import sort_sellable_code43from stoqlib.lib.defaults import sort_sellable_code
44from stoqlib.lib.message import warning
45from stoqlib.gui.editors.producteditor import ProductStockEditor44from stoqlib.gui.editors.producteditor import ProductStockEditor
46from stoqlib.gui.wizards.loanwizard import NewLoanWizard, CloseLoanWizard45from stoqlib.gui.wizards.loanwizard import NewLoanWizard, CloseLoanWizard
47from stoqlib.gui.wizards.receivingwizard import ReceivingOrderWizard46from stoqlib.gui.wizards.receivingwizard import ReceivingOrderWizard
4847
=== modified file 'stoqlib/chart/chart.py'
--- stoqlib/chart/chart.py 2011-07-01 18:41:05 +0000
+++ stoqlib/chart/chart.py 2011-11-05 17:07:26 +0000
@@ -23,13 +23,13 @@
23##23##
24""" Charting """24""" Charting """
2525
26import datetime26import pprint
27import gettext27
28import string28from kiwi.python import namedAny
2929from stoqlib.lib.translation import stoqlib_gettext
30from kiwi.python import namedAny, Settable30
3131_ = stoqlib_gettext
32_ = gettext.gettext32
3333
34class DateArgument(object):34class DateArgument(object):
35 pass35 pass
3636
=== modified file 'stoqlib/chart/chartserver.py'
--- stoqlib/chart/chartserver.py 2011-07-01 18:41:05 +0000
+++ stoqlib/chart/chartserver.py 2011-11-05 17:07:26 +0000
@@ -26,15 +26,14 @@
26import cgi26import cgi
27import json27import json
2828
29from kiwi.environ import environ
30from twisted.internet import reactor29from twisted.internet import reactor
31from twisted.web.resource import Resource30from twisted.web.resource import Resource
32from twisted.web.server import Site31from twisted.web.server import Site
33from twisted.web.static import File32from twisted.web.static import File
3433
35from stoqlib.chart.chart import get_chart_class34from stoqlib.chart.chart import get_chart_class
35from stoqlib.database.runtime import get_connection
36from stoqlib.lib.template import render_template36from stoqlib.lib.template import render_template
37
38from stoqlib.lib.translation import stoqlib_gettext37from stoqlib.lib.translation import stoqlib_gettext
3938
40_ = stoqlib_gettext39_ = stoqlib_gettext
@@ -53,6 +52,8 @@
53class ChartChartResource(Resource):52class ChartChartResource(Resource):
5453
55 def _get_chart(self, request):54 def _get_chart(self, request):
55 conn = get_connection()
56
56 if not '?' in request.uri:57 if not '?' in request.uri:
57 raise TypeError("Missing arguments")58 raise TypeError("Missing arguments")
58 args = cgi.parse_qs(request.uri.split('?', 1)[1])59 args = cgi.parse_qs(request.uri.split('?', 1)[1])
@@ -70,7 +71,8 @@
70 opt['data'] = chart.run()71 opt['data'] = chart.run()
71 opt['options'] = {72 opt['options'] = {
72 "xaxis": { "mode": "time" },73 "xaxis": { "mode": "time" },
73 "bars": { "show": True, "barWidth": 20 * _JS_DAY },74 # XXX: _JS_DAY is not defined
75 #"bars": { "show": True, "barWidth": 20 * _JS_DAY },
74 "points": { "show": False },76 "points": { "show": False },
75 "lines": { "show": False },77 "lines": { "show": False },
76 "grid": { "hoverable": True,78 "grid": { "hoverable": True,
7779
=== modified file 'stoqlib/chart/paymentcharts.py'
--- stoqlib/chart/paymentcharts.py 2011-07-01 19:35:48 +0000
+++ stoqlib/chart/paymentcharts.py 2011-11-05 17:07:26 +0000
@@ -23,9 +23,11 @@
23##23##
24""" Payment charts """24""" Payment charts """
2525
26import datetime
26import string27import string
2728
28from stoqlib.chart.chart import Chart29from stoqlib.chart.chart import Chart
30from stoqlib.database.runtime import get_connection
29from stoqlib.lib.translation import stoqlib_gettext31from stoqlib.lib.translation import stoqlib_gettext
3032
31_ = stoqlib_gettext33_ = stoqlib_gettext
@@ -164,6 +166,7 @@
164 @month: month to show payments for166 @month: month to show payments for
165 @returns: (month, total in payments, total out payments, profit)167 @returns: (month, total in payments, total out payments, profit)
166 """168 """
169 conn = get_connection()
167170
168 if 2100 > year < 1900:171 if 2100 > year < 1900:
169 raise ValueError(year)172 raise ValueError(year)
170173
=== modified file 'stoqlib/database/admin.py'
--- stoqlib/database/admin.py 2011-07-27 15:43:30 +0000
+++ stoqlib/database/admin.py 2011-11-05 17:07:26 +0000
@@ -236,10 +236,10 @@
236 TaxType.NONE,236 TaxType.NONE,
237 TaxType.SERVICE]:237 TaxType.SERVICE]:
238 desc = describe_constant(enum)238 desc = describe_constant(enum)
239 constant = SellableTaxConstant(description=desc,239 SellableTaxConstant(description=desc,
240 tax_type=int(enum),240 tax_type=int(enum),
241 tax_value=None,241 tax_value=None,
242 connection=trans)242 connection=trans)
243243
244 trans.commit(close=True)244 trans.commit(close=True)
245245
246246
=== modified file 'stoqlib/database/database.py'
--- stoqlib/database/database.py 2011-10-26 17:46:38 +0000
+++ stoqlib/database/database.py 2011-11-05 17:07:26 +0000
@@ -38,7 +38,7 @@
38from stoqlib.database.exceptions import SQLError38from stoqlib.database.exceptions import SQLError
39from stoqlib.database.interfaces import IDatabaseSettings39from stoqlib.database.interfaces import IDatabaseSettings
4040
41from stoqlib.lib.message import error, warning41from stoqlib.lib.message import warning
42from stoqlib.lib.translation import stoqlib_gettext42from stoqlib.lib.translation import stoqlib_gettext
4343
44_ = stoqlib_gettext44_ = stoqlib_gettext
@@ -308,7 +308,7 @@
308 log.debug('executing %s' % (' '.join(args), ))308 log.debug('executing %s' % (' '.join(args), ))
309309
310 proc = subprocess.Popen(args, stderr=subprocess.PIPE)310 proc = subprocess.Popen(args, stderr=subprocess.PIPE)
311 retcode = proc.wait()311 proc.wait()
312 return newname312 return newname
313 else:313 else:
314 raise NotImplementedError(settings.rdbms)314 raise NotImplementedError(settings.rdbms)
315315
=== modified file 'stoqlib/database/migration.py'
--- stoqlib/database/migration.py 2011-11-01 01:13:11 +0000
+++ stoqlib/database/migration.py 2011-11-05 17:07:26 +0000
@@ -38,7 +38,6 @@
3838
39from stoqlib.database.database import (execute_sql, dump_database,39from stoqlib.database.database import (execute_sql, dump_database,
40 restore_database, test_connection)40 restore_database, test_connection)
41from stoqlib.database.exceptions import SQLError
42from stoqlib.database.runtime import new_transaction, get_connection41from stoqlib.database.runtime import new_transaction, get_connection
43from stoqlib.domain.plugin import InstalledPlugin42from stoqlib.domain.plugin import InstalledPlugin
44from stoqlib.domain.profile import update_profile_applications43from stoqlib.domain.profile import update_profile_applications
@@ -327,7 +326,7 @@
327 super(StoqlibSchemaMigration, self).update()326 super(StoqlibSchemaMigration, self).update()
328 if plugins:327 if plugins:
329 self.update_plugins()328 self.update_plugins()
330 except Exception, e:329 except Exception:
331 exc = sys.exc_info()330 exc = sys.exc_info()
332 tb_str = ''.join(traceback.format_exception(*exc))331 tb_str = ''.join(traceback.format_exception(*exc))
333 collect_traceback(exc, submit=True)332 collect_traceback(exc, submit=True)
334333
=== modified file 'stoqlib/database/runtime.py'
--- stoqlib/database/runtime.py 2011-10-28 15:04:24 +0000
+++ stoqlib/database/runtime.py 2011-11-05 17:07:26 +0000
@@ -32,7 +32,7 @@
32 IDatabaseSettings, IConnection, ITransaction, ICurrentBranch,32 IDatabaseSettings, IConnection, ITransaction, ICurrentBranch,
33 ICurrentBranchStation, ICurrentUser)33 ICurrentBranchStation, ICurrentUser)
34from stoqlib.database.orm import ORMObject, Transaction34from stoqlib.database.orm import ORMObject, Transaction
35from stoqlib.database.orm import sqlIdentifier, const, Update, IN35from stoqlib.database.orm import sqlIdentifier, const
36from stoqlib.exceptions import LoginError, StoqlibError36from stoqlib.exceptions import LoginError, StoqlibError
37from stoqlib.lib.message import error, yesno37from stoqlib.lib.message import error, yesno
38from stoqlib.lib.translation import stoqlib_gettext38from stoqlib.lib.translation import stoqlib_gettext
3939
=== modified file 'stoqlib/database/testsuite.py'
--- stoqlib/database/testsuite.py 2011-07-20 20:33:08 +0000
+++ stoqlib/database/testsuite.py 2011-11-05 17:07:26 +0000
@@ -216,7 +216,7 @@
216 initialize_system()216 initialize_system()
217 ensure_admin_user("")217 ensure_admin_user("")
218 create(utilities=True)218 create(utilities=True)
219 except Exception, e:219 except Exception:
220 # Work around trial220 # Work around trial
221 import traceback221 import traceback
222 traceback.print_exc()222 traceback.print_exc()
223223
=== modified file 'stoqlib/domain/address.py'
--- stoqlib/domain/address.py 2011-09-28 19:55:17 +0000
+++ stoqlib/domain/address.py 2011-11-05 17:07:26 +0000
@@ -25,7 +25,7 @@
25from kiwi.argcheck import argcheck25from kiwi.argcheck import argcheck
26from zope.interface import implements26from zope.interface import implements
2727
28from stoqlib.database.orm import (AND, const, UnicodeCol, IntCol, ForeignKey,28from stoqlib.database.orm import (AND, UnicodeCol, IntCol, ForeignKey,
29 BoolCol, ILIKE)29 BoolCol, ILIKE)
30from stoqlib.database.runtime import StoqlibTransaction30from stoqlib.database.runtime import StoqlibTransaction
31from stoqlib.domain.base import Domain31from stoqlib.domain.base import Domain
3232
=== modified file 'stoqlib/domain/base.py'
--- stoqlib/domain/base.py 2011-10-13 17:51:40 +0000
+++ stoqlib/domain/base.py 2011-11-05 17:07:26 +0000
@@ -26,7 +26,7 @@
26from zope.interface.interface import adapter_hooks26from zope.interface.interface import adapter_hooks
2727
28from stoqlib.database.orm import orm_name, ForeignKey, IntCol28from stoqlib.database.orm import orm_name, ForeignKey, IntCol
29from stoqlib.database.orm import ORMObject, const, AND, const, ILIKE29from stoqlib.database.orm import ORMObject, const, AND, ILIKE
30from stoqlib.database.runtime import (StoqlibTransaction,30from stoqlib.database.runtime import (StoqlibTransaction,
31 get_current_user, get_current_station)31 get_current_user, get_current_station)
32from stoqlib.domain.system import TransactionEntry32from stoqlib.domain.system import TransactionEntry
3333
=== modified file 'stoqlib/domain/devices.py'
--- stoqlib/domain/devices.py 2011-07-15 18:01:20 +0000
+++ stoqlib/domain/devices.py 2011-11-05 17:07:26 +0000
@@ -25,8 +25,6 @@
25Domain classes related to stoqdrivers package.25Domain classes related to stoqdrivers package.
26"""26"""
2727
28import platform
29
30from zope.interface import implements28from zope.interface import implements
31from stoqdrivers.printers.cheque import ChequePrinter29from stoqdrivers.printers.cheque import ChequePrinter
32from stoqdrivers.scales.scales import Scale30from stoqdrivers.scales.scales import Scale
3331
=== modified file 'stoqlib/domain/event.py'
--- stoqlib/domain/event.py 2011-10-29 20:25:07 +0000
+++ stoqlib/domain/event.py 2011-11-05 17:07:26 +0000
@@ -64,9 +64,9 @@
64 @classmethod64 @classmethod
65 def log(cls, event_type, description):65 def log(cls, event_type, description):
66 trans = new_transaction()66 trans = new_transaction()
67 event = cls(event_type=event_type,67 cls(event_type=event_type,
68 description=description,68 description=description,
69 connection=trans)69 connection=trans)
70 trans.commit()70 trans.commit()
7171
7272
7373
=== modified file 'stoqlib/domain/product.py'
--- stoqlib/domain/product.py 2011-10-27 19:50:12 +0000
+++ stoqlib/domain/product.py 2011-11-05 17:07:26 +0000
@@ -38,8 +38,7 @@
38from stoqlib.domain.events import (ProductCreateEvent, ProductEditEvent,38from stoqlib.domain.events import (ProductCreateEvent, ProductEditEvent,
39 ProductRemoveEvent, ProductStockUpdateEvent)39 ProductRemoveEvent, ProductStockUpdateEvent)
40from stoqlib.domain.person import Person40from stoqlib.domain.person import Person
41from stoqlib.domain.interfaces import (IStorable, IContainer,41from stoqlib.domain.interfaces import IStorable, IBranch
42 IBranch)
43from stoqlib.exceptions import StockError, DatabaseInconsistency42from stoqlib.exceptions import StockError, DatabaseInconsistency
44from stoqlib.lib.translation import stoqlib_gettext43from stoqlib.lib.translation import stoqlib_gettext
45from stoqlib.lib.parameters import sysparam44from stoqlib.lib.parameters import sysparam
4645
=== modified file 'stoqlib/domain/test/test_nfe.py'
--- stoqlib/domain/test/test_nfe.py 2011-11-01 01:13:11 +0000
+++ stoqlib/domain/test/test_nfe.py 2011-11-05 17:07:26 +0000
@@ -41,8 +41,7 @@
4141
42# This test should be inside plugins/nfe, but it's not reachable there42# This test should be inside plugins/nfe, but it's not reachable there
43sys.path.append('plugins/nfe')43sys.path.append('plugins/nfe')
44from nfegenerator import (NFeGenerator, remove_accentuation, nfe_tostring,44from nfegenerator import NFeGenerator, remove_accentuation, NFeIdentification
45 NFeIdentification)
4645
4746
48class TestNfeGenerator(DomainTest):47class TestNfeGenerator(DomainTest):
4948
=== modified file 'stoqlib/domain/test/test_person.py'
--- stoqlib/domain/test/test_person.py 2011-10-28 18:01:18 +0000
+++ stoqlib/domain/test/test_person.py 2011-11-05 17:07:26 +0000
@@ -27,8 +27,6 @@
2727
28from kiwi.datatypes import currency28from kiwi.datatypes import currency
2929
30from twisted.trial.unittest import SkipTest
31
32from stoqlib.database.orm import ORMObjectMoreThanOneResultError, AND30from stoqlib.database.orm import ORMObjectMoreThanOneResultError, AND
33from stoqlib.domain.account import BankAccount31from stoqlib.domain.account import BankAccount
34from stoqlib.domain.person import Calls, Liaison32from stoqlib.domain.person import Calls, Liaison
3533
=== modified file 'stoqlib/domain/test/test_sellable.py'
--- stoqlib/domain/test/test_sellable.py 2011-10-03 16:59:34 +0000
+++ stoqlib/domain/test/test_sellable.py 2011-11-05 17:07:26 +0000
@@ -369,7 +369,7 @@
369 def testRemove(self):369 def testRemove(self):
370 # Remove category price and sellable370 # Remove category price and sellable
371 sellable = self.create_sellable()371 sellable = self.create_sellable()
372 storable = sellable.product.addFacet(IStorable, connection=self.trans)372 sellable.product.addFacet(IStorable, connection=self.trans)
373373
374 ClientCategoryPrice(sellable=sellable,374 ClientCategoryPrice(sellable=sellable,
375 category=self.create_client_category(),375 category=self.create_client_category(),
376376
=== modified file 'stoqlib/gui/accounttree.py'
--- stoqlib/gui/accounttree.py 2011-08-08 19:18:15 +0000
+++ stoqlib/gui/accounttree.py 2011-11-05 17:07:26 +0000
@@ -22,7 +22,6 @@
22import gtk22import gtk
2323
24from kiwi.currency import currency24from kiwi.currency import currency
25from kiwi.datatypes import converter
26from kiwi.python import Settable25from kiwi.python import Settable
27from kiwi.ui.objectlist import ColoredColumn, Column, ObjectTree26from kiwi.ui.objectlist import ColoredColumn, Column, ObjectTree
28from stoqlib.database.runtime import get_connection27from stoqlib.database.runtime import get_connection
2928
=== modified file 'stoqlib/gui/base/lists.py'
--- stoqlib/gui/base/lists.py 2011-08-01 13:47:11 +0000
+++ stoqlib/gui/base/lists.py 2011-11-05 17:07:26 +0000
@@ -24,7 +24,6 @@
24""" List management for common dialogs. """24""" List management for common dialogs. """
2525
26import gtk26import gtk
27from kiwi.ui.delegates import GladeSlaveDelegate
28from kiwi.ui.objectlist import ObjectList27from kiwi.ui.objectlist import ObjectList
29from kiwi.ui.listdialog import ListSlave28from kiwi.ui.listdialog import ListSlave
30from kiwi.utils import gsignal29from kiwi.utils import gsignal
3130
=== modified file 'stoqlib/gui/dialogs/branchdialog.py'
--- stoqlib/gui/dialogs/branchdialog.py 2011-07-11 19:31:50 +0000
+++ stoqlib/gui/dialogs/branchdialog.py 2011-11-05 17:07:26 +0000
@@ -65,10 +65,6 @@
65 BaseEditor.__init__(self, trans, model, visual_mode=False)65 BaseEditor.__init__(self, trans, model, visual_mode=False)
66 self._setup_widgets()66 self._setup_widgets()
6767
68 def _setup_widgets(self):
69 self.title_label.set_size('large')
70 self.title_label.set_bold(True)
71
72 def _update_system_parameters(self, person):68 def _update_system_parameters(self, person):
73 icms = self.tax_proxy.model.icms69 icms = self.tax_proxy.model.icms
74 self.param.update_parameter('ICMS_TAX', unicode(icms))70 self.param.update_parameter('ICMS_TAX', unicode(icms))
7571
=== modified file 'stoqlib/gui/dialogs/chartdialog.py'
--- stoqlib/gui/dialogs/chartdialog.py 2011-07-01 18:41:05 +0000
+++ stoqlib/gui/dialogs/chartdialog.py 2011-11-05 17:07:26 +0000
@@ -26,6 +26,8 @@
26import gtk26import gtk
27import webkit27import webkit
2828
29from twisted.internet import reactor
30
29class ChartDialog(gtk.Window):31class ChartDialog(gtk.Window):
30 def __init__(self):32 def __init__(self):
31 gtk.Window.__init__(self)33 gtk.Window.__init__(self)
3234
=== modified file 'stoqlib/gui/dialogs/productiondialog.py'
--- stoqlib/gui/dialogs/productiondialog.py 2011-10-28 17:21:28 +0000
+++ stoqlib/gui/dialogs/productiondialog.py 2011-11-05 17:07:26 +0000
@@ -24,7 +24,6 @@
24##24##
2525
26from decimal import Decimal26from decimal import Decimal
27from sys import maxint as MAXINT
2827
29import gtk28import gtk
30from gtk import gdk29from gtk import gdk
@@ -232,7 +231,6 @@
232 self.remove_product_button.set_sensitive(can_remove)231 self.remove_product_button.set_sensitive(can_remove)
233232
234 def _get_columns(self):233 def _get_columns(self):
235 adj = gtk.Adjustment(upper=MAXINT, step_incr=1)
236 return [Column('code', title=_(u'Code'), data_type=int),234 return [Column('code', title=_(u'Code'), data_type=int),
237 Column('category', title=_(u'Category'), data_type=str,235 Column('category', title=_(u'Category'), data_type=str,
238 expand=True, sorted=True),236 expand=True, sorted=True),
@@ -312,7 +310,6 @@
312 self.export_csv_button.set_sensitive(self.has_rows)310 self.export_csv_button.set_sensitive(self.has_rows)
313311
314 def _get_columns(self):312 def _get_columns(self):
315 adj = gtk.Adjustment(upper=MAXINT, step_incr=1)
316 return [Column('industrialized_str', title=_(u'Ind.'), data_type=str),313 return [Column('industrialized_str', title=_(u'Ind.'), data_type=str),
317 Column('code', title=_(u'code'), data_type=str),314 Column('code', title=_(u'code'), data_type=str),
318 Column('category', title=_(u'Category'), data_type=str,315 Column('category', title=_(u'Category'), data_type=str,
319316
=== modified file 'stoqlib/gui/dialogs/productionquotedialog.py'
--- stoqlib/gui/dialogs/productionquotedialog.py 2011-02-08 14:21:07 +0000
+++ stoqlib/gui/dialogs/productionquotedialog.py 2011-11-05 17:07:26 +0000
@@ -57,7 +57,6 @@
57 order = self._create_purchase_order(trans)57 order = self._create_purchase_order(trans)
58 to_quote_items = {}58 to_quote_items = {}
59 for production in productions:59 for production in productions:
60 materials = production.get_material_items()
61 for material in production.get_material_items():60 for material in production.get_material_items():
62 if material.to_purchase <= 0:61 if material.to_purchase <= 0:
63 continue62 continue
6463
=== modified file 'stoqlib/gui/dialogs/purchasedetails.py'
--- stoqlib/gui/dialogs/purchasedetails.py 2011-07-12 19:35:02 +0000
+++ stoqlib/gui/dialogs/purchasedetails.py 2011-11-05 17:07:26 +0000
@@ -76,7 +76,6 @@
7676
77 if orders.count():77 if orders.count():
78 discount = surcharge = freight = subtotal = total = 078 discount = surcharge = freight = subtotal = total = 0
79 freight_type = None
80 for order in orders:79 for order in orders:
81 discount += order._get_total_discounts()80 discount += order._get_total_discounts()
82 surcharge += order._get_total_surcharges()81 surcharge += order._get_total_surcharges()
8382
=== modified file 'stoqlib/gui/editors/accounttransactioneditor.py'
--- stoqlib/gui/editors/accounttransactioneditor.py 2011-08-10 18:24:18 +0000
+++ stoqlib/gui/editors/accounttransactioneditor.py 2011-11-05 17:07:26 +0000
@@ -24,7 +24,6 @@
2424
25import datetime25import datetime
2626
27import gobject
28import gtk27import gtk
29from kiwi.currency import currency28from kiwi.currency import currency
30from kiwi.datatypes import ValidationError29from kiwi.datatypes import ValidationError
3130
=== modified file 'stoqlib/gui/editors/personeditor.py'
--- stoqlib/gui/editors/personeditor.py 2011-08-04 19:49:44 +0000
+++ stoqlib/gui/editors/personeditor.py 2011-11-05 17:07:26 +0000
@@ -44,7 +44,7 @@
44from stoqlib.domain.person import EmployeeRole, PersonAdaptToCreditProvider44from stoqlib.domain.person import EmployeeRole, PersonAdaptToCreditProvider
45from stoqlib.domain.interfaces import (IClient, ICreditProvider, IEmployee,45from stoqlib.domain.interfaces import (IClient, ICreditProvider, IEmployee,
46 ISupplier, ITransporter, IUser,46 ISupplier, ITransporter, IUser,
47 ICompany, IIndividual, IBranch)47 IIndividual, IBranch)
4848
49_ = stoqlib_gettext49_ = stoqlib_gettext
5050
5151
=== modified file 'stoqlib/gui/editors/profileeditor.py'
--- stoqlib/gui/editors/profileeditor.py 2011-09-28 19:55:17 +0000
+++ stoqlib/gui/editors/profileeditor.py 2011-11-05 17:07:26 +0000
@@ -28,8 +28,6 @@
28from kiwi.datatypes import ValidationError28from kiwi.datatypes import ValidationError
29from kiwi.ui.widgets.checkbutton import ProxyCheckButton29from kiwi.ui.widgets.checkbutton import ProxyCheckButton
3030
31from stoqlib.database.orm import const, AND
32from stoqlib.database.runtime import get_connection
33from stoqlib.domain.profile import UserProfile, ProfileSettings31from stoqlib.domain.profile import UserProfile, ProfileSettings
34from stoqlib.gui.editors.baseeditor import BaseEditor32from stoqlib.gui.editors.baseeditor import BaseEditor
35from stoqlib.lib.interfaces import IApplicationDescriptions33from stoqlib.lib.interfaces import IApplicationDescriptions
3634
=== modified file 'stoqlib/gui/editors/sellableeditor.py'
--- stoqlib/gui/editors/sellableeditor.py 2011-10-03 16:59:34 +0000
+++ stoqlib/gui/editors/sellableeditor.py 2011-11-05 17:07:26 +0000
@@ -410,7 +410,6 @@
410 def _update_tax_value(self):410 def _update_tax_value(self):
411 if not hasattr(self, 'tax_proxy'):411 if not hasattr(self, 'tax_proxy'):
412 return412 return
413 constant = self.tax_constant.get_selected_data()
414 self.tax_proxy.update('tax_constant.tax_value')413 self.tax_proxy.update('tax_constant.tax_value')
415414
416 def get_taxes(self):415 def get_taxes(self):
417416
=== modified file 'stoqlib/gui/editors/tilleditor.py'
--- stoqlib/gui/editors/tilleditor.py 2011-10-05 17:33:34 +0000
+++ stoqlib/gui/editors/tilleditor.py 2011-11-05 17:07:26 +0000
@@ -29,12 +29,12 @@
29from kiwi.python import Settable29from kiwi.python import Settable
30from kiwi.ui.objectlist import Column, ColoredColumn, SummaryLabel30from kiwi.ui.objectlist import Column, ColoredColumn, SummaryLabel
3131
32from stoqdrivers.exceptions import CouponOpenError, DriverError32from stoqdrivers.exceptions import DriverError
3333
34from stoqlib.database.orm import const34from stoqlib.database.orm import const
35from stoqlib.database.runtime import (get_current_station, new_transaction,35from stoqlib.database.runtime import (get_current_station, new_transaction,
36 finish_transaction)36 finish_transaction)
37from stoqlib.domain.account import Account, AccountTransaction37from stoqlib.domain.account import AccountTransaction
38from stoqlib.domain.events import (TillOpenEvent, TillCloseEvent,38from stoqlib.domain.events import (TillOpenEvent, TillCloseEvent,
39 TillAddTillEntryEvent,39 TillAddTillEntryEvent,
40 TillAddCashEvent, TillRemoveCashEvent)40 TillAddCashEvent, TillRemoveCashEvent)
@@ -50,7 +50,6 @@
50_ = stoqlib_gettext50_ = stoqlib_gettext
5151
52def _create_transaction(conn, till_entry):52def _create_transaction(conn, till_entry):
53 till = till_entry.till
54 AccountTransaction(description=till_entry.description,53 AccountTransaction(description=till_entry.description,
55 source_account=sysparam(conn).IMBALANCE_ACCOUNT,54 source_account=sysparam(conn).IMBALANCE_ACCOUNT,
56 account=sysparam(conn).TILLS_ACCOUNT,55 account=sysparam(conn).TILLS_ACCOUNT,
5756
=== modified file 'stoqlib/gui/fiscalprinter.py'
--- stoqlib/gui/fiscalprinter.py 2011-11-01 01:13:11 +0000
+++ stoqlib/gui/fiscalprinter.py 2011-11-05 17:07:26 +0000
@@ -54,8 +54,6 @@
54from stoqlib.lib.translation import stoqlib_gettext54from stoqlib.lib.translation import stoqlib_gettext
55from stoqlib.gui.wizards.salewizard import ConfirmSaleWizard55from stoqlib.gui.wizards.salewizard import ConfirmSaleWizard
5656
57from stoqlib.domain.devices import FiscalDayHistory, FiscalDayTax
58
5957
60_ = stoqlib_gettext58_ = stoqlib_gettext
6159
@@ -212,7 +210,7 @@
212210
213 try:211 try:
214 CouponCreatedEvent.emit(coupon)212 CouponCreatedEvent.emit(coupon)
215 except (DriverError, DeviceError), e:213 except (DriverError, DeviceError):
216 warning('Não foi possível abrir o cupom')214 warning('Não foi possível abrir o cupom')
217 coupon = None215 coupon = None
218216
219217
=== modified file 'stoqlib/gui/printing.py'
--- stoqlib/gui/printing.py 2011-10-03 14:12:38 +0000
+++ stoqlib/gui/printing.py 2011-11-05 17:07:26 +0000
@@ -207,30 +207,6 @@
207 kwargs['filter_strings'] = filter_strings207 kwargs['filter_strings'] = filter_strings
208 return kwargs208 return kwargs
209209
210
211def print_report(report_class, *args, **kwargs):
212 if kwargs.has_key('filters') and kwargs['filters']:
213 kwargs = describe_search_filters_for_reports(**kwargs)
214
215 tmp = tempfile.mktemp(suffix='.pdf', prefix='stoqlib-reporting')
216 report = report_class(tmp, *args, **kwargs)
217 report.filename = tmp
218 report.save()
219 op = PrintOperation()
220 op.print_pdf(report)
221
222def describe_search_filters_for_reports(**kwargs):
223 filters = kwargs.pop('filters')
224 filter_strings = []
225 for filter in filters:
226 description = filter.get_description()
227 if description:
228 filter_strings.append(description)
229
230 kwargs['filter_strings'] = filter_strings
231 return kwargs
232
233
234def print_report(report_class, *args, **kwargs):210def print_report(report_class, *args, **kwargs):
235 if kwargs.has_key('filters') and kwargs['filters']:211 if kwargs.has_key('filters') and kwargs['filters']:
236 kwargs = describe_search_filters_for_reports(**kwargs)212 kwargs = describe_search_filters_for_reports(**kwargs)
237213
=== modified file 'stoqlib/gui/search/eventsearch.py'
--- stoqlib/gui/search/eventsearch.py 2011-10-29 20:25:07 +0000
+++ stoqlib/gui/search/eventsearch.py 2011-11-05 17:07:26 +0000
@@ -24,8 +24,6 @@
24##24##
25""" Implementation of event search """25""" Implementation of event search """
2626
27import datetime
28
29from kiwi.ui.objectlist import Column27from kiwi.ui.objectlist import Column
3028
31from stoqlib.gui.base.search import SearchEditor29from stoqlib.gui.base.search import SearchEditor
3230
=== modified file 'stoqlib/gui/search/fiscalsearch.py'
--- stoqlib/gui/search/fiscalsearch.py 2011-07-14 17:15:00 +0000
+++ stoqlib/gui/search/fiscalsearch.py 2011-11-05 17:07:26 +0000
@@ -83,11 +83,9 @@
83 searchbar_result_strings = _("fiscal entry"), _("fiscal entries")83 searchbar_result_strings = _("fiscal entry"), _("fiscal entries")
8484
85 def _setup_columns(self, column, table, col_name, summary_label_text):85 def _setup_columns(self, column, table, col_name, summary_label_text):
86 label_text = '<b>%s</b>' % summary_label_text
87 columns = self.get_columns() + [column]86 columns = self.get_columns() + [column]
88 self.results.set_columns(columns)87 self.results.set_columns(columns)
89 self.set_table(table)88 self.set_table(table)
90 #self.setup_summary_label(col_name, label_text)
9189
92 def _setup_icms_columns(self):90 def _setup_icms_columns(self):
93 col = SearchColumn('icms_value',91 col = SearchColumn('icms_value',
9492
=== modified file 'stoqlib/gui/slaves/employeeslave.py'
--- stoqlib/gui/slaves/employeeslave.py 2011-02-08 14:06:58 +0000
+++ stoqlib/gui/slaves/employeeslave.py 2011-11-05 17:07:26 +0000
@@ -207,11 +207,8 @@
207207
208 def _update_sensitivity(self):208 def _update_sensitivity(self):
209 editor = True209 editor = True
210 settings = False
211 if self.role.get_text():210 if self.role.get_text():
212 editor = self.role.is_valid()211 editor = self.role.is_valid()
213 if editor:
214 settings = self._is_default_salesperson_role()
215 else:212 else:
216 self.model.role = None213 self.model.role = None
217 self.role_editor_button.set_sensitive(editor)214 self.role_editor_button.set_sensitive(editor)
218215
=== modified file 'stoqlib/gui/slaves/paymentmethodslave.py'
--- stoqlib/gui/slaves/paymentmethodslave.py 2011-08-05 16:54:09 +0000
+++ stoqlib/gui/slaves/paymentmethodslave.py 2011-11-05 17:07:26 +0000
@@ -28,10 +28,8 @@
28from kiwi.ui.delegates import GladeSlaveDelegate28from kiwi.ui.delegates import GladeSlaveDelegate
29from kiwi.utils import gsignal29from kiwi.utils import gsignal
3030
31from stoqlib.database.runtime import get_connection
32from stoqlib.domain.payment.views import PaymentMethodView31from stoqlib.domain.payment.views import PaymentMethodView
33from stoqlib.exceptions import StoqlibError32from stoqlib.exceptions import StoqlibError
34from stoqlib.lib.message import marker
35from stoqlib.lib.translation import stoqlib_gettext33from stoqlib.lib.translation import stoqlib_gettext
3634
37N_ = _ = stoqlib_gettext35N_ = _ = stoqlib_gettext
3836
=== modified file 'stoqlib/gui/slaves/userslave.py'
--- stoqlib/gui/slaves/userslave.py 2011-09-28 19:55:17 +0000
+++ stoqlib/gui/slaves/userslave.py 2011-11-05 17:07:26 +0000
@@ -29,10 +29,9 @@
29import gtk29import gtk
30from kiwi.datatypes import ValidationError30from kiwi.datatypes import ValidationError
3131
32from stoqlib.database.orm import const
33from stoqlib.database.runtime import get_current_user32from stoqlib.database.runtime import get_current_user
34from stoqlib.domain.profile import UserProfile33from stoqlib.domain.profile import UserProfile
35from stoqlib.domain.person import EmployeeRole, Person34from stoqlib.domain.person import EmployeeRole
36from stoqlib.domain.interfaces import IEmployee, ISalesPerson, IUser35from stoqlib.domain.interfaces import IEmployee, ISalesPerson, IUser
37from stoqlib.gui.editors.baseeditor import BaseEditor, BaseEditorSlave36from stoqlib.gui.editors.baseeditor import BaseEditor, BaseEditorSlave
38from stoqlib.gui.base.dialogs import run_dialog37from stoqlib.gui.base.dialogs import run_dialog
3938
=== modified file 'stoqlib/gui/splash.py'
--- stoqlib/gui/splash.py 2011-06-29 20:21:26 +0000
+++ stoqlib/gui/splash.py 2011-11-05 17:07:26 +0000
@@ -27,7 +27,6 @@
27import time27import time
2828
29import gobject29import gobject
30import cairo
31import gtk30import gtk
32import pango31import pango
33import pangocairo32import pangocairo
3433
=== modified file 'stoqlib/gui/templates/individualtemplate.py'
--- stoqlib/gui/templates/individualtemplate.py 2011-06-21 13:31:33 +0000
+++ stoqlib/gui/templates/individualtemplate.py 2011-11-05 17:07:26 +0000
@@ -140,7 +140,6 @@
140 self.birth_state.prefill(get_country_states())140 self.birth_state.prefill(get_country_states())
141141
142 def _update_marital_status(self):142 def _update_marital_status(self):
143 marital_status = self.marital_status.get_selected_data()
144 if self.model.is_married():143 if self.model.is_married():
145 self.spouse_lbl.show()144 self.spouse_lbl.show()
146 self.spouse_name.show()145 self.spouse_name.show()
147146
=== modified file 'stoqlib/gui/wizards/purchasewizard.py'
--- stoqlib/gui/wizards/purchasewizard.py 2011-11-04 12:06:43 +0000
+++ stoqlib/gui/wizards/purchasewizard.py 2011-11-05 17:07:26 +0000
@@ -25,7 +25,6 @@
25""" Purchase wizard definition """25""" Purchase wizard definition """
2626
27import datetime27import datetime
28from decimal import Decimal
29import sys28import sys
3029
31import gtk30import gtk
@@ -38,7 +37,7 @@
38from stoqlib.domain.interfaces import IBranch, ITransporter, ISupplier37from stoqlib.domain.interfaces import IBranch, ITransporter, ISupplier
39from stoqlib.domain.payment.group import PaymentGroup38from stoqlib.domain.payment.group import PaymentGroup
40from stoqlib.domain.payment.operation import register_payment_operations39from stoqlib.domain.payment.operation import register_payment_operations
41from stoqlib.domain.person import Person, PersonAdaptToTransporter40from stoqlib.domain.person import Person
42from stoqlib.domain.product import ProductSupplierInfo41from stoqlib.domain.product import ProductSupplierInfo
43from stoqlib.domain.purchase import PurchaseOrder, PurchaseItem42from stoqlib.domain.purchase import PurchaseOrder, PurchaseItem
44from stoqlib.domain.receiving import (ReceivingOrder, ReceivingOrderItem,43from stoqlib.domain.receiving import (ReceivingOrder, ReceivingOrderItem,
4544
=== modified file 'stoqlib/importers/branchimporter.py'
--- stoqlib/importers/branchimporter.py 2011-02-08 14:06:58 +0000
+++ stoqlib/importers/branchimporter.py 2011-11-05 17:07:26 +0000
@@ -62,13 +62,16 @@
62 state=data.state,62 state=data.state,
63 country=data.country)63 country=data.country)
64 streetnumber = data.streetnumber and int(data.streetnumber) or None64 streetnumber = data.streetnumber and int(data.streetnumber) or None
65 address = Address(is_main_address=True,65 Address(
66 person=person, city_location=ctloc,66 is_main_address=True,
67 connection=trans,67 person=person,
68 street=data.street,68 city_location=ctloc,
69 streetnumber=streetnumber,69 connection=trans,
70 district=data.district,70 street=data.street,
71 postal_code=data.postal_code)71 streetnumber=streetnumber,
72 district=data.district,
73 postal_code=data.postal_code
74 )
7275
73 person.addFacet(IBranch, connection=trans)76 person.addFacet(IBranch, connection=trans)
7477
7578
=== modified file 'stoqlib/importers/clientimporter.py'
--- stoqlib/importers/clientimporter.py 2011-02-08 14:06:58 +0000
+++ stoqlib/importers/clientimporter.py 2011-11-05 17:07:26 +0000
@@ -59,11 +59,14 @@
59 state=data.state,59 state=data.state,
60 country=data.country)60 country=data.country)
61 streetnumber = data.streetnumber and int(data.streetnumber) or None61 streetnumber = data.streetnumber and int(data.streetnumber) or None
62 address = Address(is_main_address=True,62 Address(
63 person=person, city_location=ctloc,63 is_main_address=True,
64 connection=trans,64 person=person,
65 street=data.street,65 city_location=ctloc,
66 streetnumber=streetnumber,66 connection=trans,
67 district=data.district)67 street=data.street,
68 streetnumber=streetnumber,
69 district=data.district
70 )
6871
69 person.addFacet(IClient, connection=trans)72 person.addFacet(IClient, connection=trans)
7073
=== modified file 'stoqlib/importers/creditproviderimporter.py'
--- stoqlib/importers/creditproviderimporter.py 2011-02-08 14:06:58 +0000
+++ stoqlib/importers/creditproviderimporter.py 2011-11-05 17:07:26 +0000
@@ -64,12 +64,13 @@
64 state=data.state,64 state=data.state,
65 country=data.country)65 country=data.country)
66 streetnumber = data.streetnumber and int(data.streetnumber) or None66 streetnumber = data.streetnumber and int(data.streetnumber) or None
67 address = Address(is_main_address=True,67 Address(is_main_address=True,
68 person=person, city_location=ctloc,68 person=person,
69 connection=trans,69 city_location=ctloc,
70 street=data.street,70 connection=trans,
71 streetnumber=streetnumber,71 street=data.street,
72 district=data.district)72 streetnumber=streetnumber,
73 district=data.district)
7374
74 person.addFacet(ICreditProvider, connection=trans,75 person.addFacet(ICreditProvider, connection=trans,
75 open_contract_date=const.NOW(),76 open_contract_date=const.NOW(),
7677
=== modified file 'stoqlib/importers/csvimporter.py'
--- stoqlib/importers/csvimporter.py 2011-07-15 19:57:51 +0000
+++ stoqlib/importers/csvimporter.py 2011-11-05 17:07:26 +0000
@@ -73,9 +73,6 @@
73 #73 #
7474
75 def feed(self, fp, filename='<stdin>'):75 def feed(self, fp, filename='<stdin>'):
76 field_names = self.fields + self.optional_fields
77
78 t = time.time()
79 trans = new_transaction()76 trans = new_transaction()
80 self.before_start(trans)77 self.before_start(trans)
81 trans.commit(close=True)78 trans.commit(close=True)
@@ -86,6 +83,7 @@
86 return len(self.rows)83 return len(self.rows)
8784
88 def process_item(self, trans, item_no):85 def process_item(self, trans, item_no):
86 t = time.time()
89 item = self.rows[item_no]87 item = self.rows[item_no]
90 if not item or item[0].startswith('%'):88 if not item or item[0].startswith('%'):
91 self.lineno += 189 self.lineno += 1
@@ -106,7 +104,7 @@
106 row = CSVRow(item, field_names)104 row = CSVRow(item, field_names)
107 try:105 try:
108 self.process_one(row, row.fields, trans)106 self.process_one(row, row.fields, trans)
109 except Exception, e:107 except Exception:
110 print108 print
111 print 'Error while processing row %d %r' % (self.lineno, row,)109 print 'Error while processing row %d %r' % (self.lineno, row,)
112 print110 print
113111
=== modified file 'stoqlib/importers/employeeimporter.py'
--- stoqlib/importers/employeeimporter.py 2011-02-08 14:06:58 +0000
+++ stoqlib/importers/employeeimporter.py 2011-11-05 17:07:26 +0000
@@ -72,7 +72,7 @@
72 registry_number=data.employee_number)72 registry_number=data.employee_number)
7373
74 start = self.parse_date(data.start)74 start = self.parse_date(data.start)
75 role_history = EmployeeRoleHistory(75 EmployeeRoleHistory(
76 connection=trans, role=role,76 connection=trans, role=role,
77 employee=employee,77 employee=employee,
78 is_active=True,78 is_active=True,
@@ -84,12 +84,13 @@
84 state=data.state,84 state=data.state,
85 country=data.country)85 country=data.country)
86 streetnumber = data.streetnumber and int(data.streetnumber) or None86 streetnumber = data.streetnumber and int(data.streetnumber) or None
87 address = Address(is_main_address=True,87 Address(is_main_address=True,
88 person=person, city_location=ctloc,88 person=person,
89 connection=trans,89 city_location=ctloc,
90 street=data.street,90 connection=trans,
91 streetnumber=streetnumber,91 street=data.street,
92 district=data.district)92 streetnumber=streetnumber,
93 district=data.district)
9394
94 profile = UserProfile.selectOneBy(name=data.profile, connection=trans)95 profile = UserProfile.selectOneBy(name=data.profile, connection=trans)
9596
9697
=== modified file 'stoqlib/importers/ofximporter.py'
--- stoqlib/importers/ofximporter.py 2011-07-19 19:18:46 +0000
+++ stoqlib/importers/ofximporter.py 2011-11-05 17:07:26 +0000
@@ -201,7 +201,6 @@
201 value=value,201 value=value,
202 date=date,202 date=date,
203 connection=trans)203 connection=trans)
204 last_date = date
205 t.sync()204 t.sync()
206 return True205 return True
207206
208207
=== modified file 'stoqlib/importers/purchaseimporter.py'
--- stoqlib/importers/purchaseimporter.py 2011-02-08 14:21:07 +0000
+++ stoqlib/importers/purchaseimporter.py 2011-11-05 17:07:26 +0000
@@ -102,10 +102,12 @@
102 connection=trans)102 connection=trans)
103103
104 for purchase_item in purchase.get_items():104 for purchase_item in purchase.get_items():
105 receicing_item = ReceivingOrderItem(connection=trans,105 ReceivingOrderItem(
106 cost=purchase_item.sellable.cost,106 connection=trans,
107 sellable=purchase_item.sellable,107 cost=purchase_item.sellable.cost,
108 quantity=int(data.quantity),108 sellable=purchase_item.sellable,
109 purchase_item=purchase_item,109 quantity=int(data.quantity),
110 receiving_order=receiving_order)110 purchase_item=purchase_item,
111 receiving_order=receiving_order
112 )
111 receiving_order.confirm()113 receiving_order.confirm()
112114
=== modified file 'stoqlib/importers/serviceimporter.py'
--- stoqlib/importers/serviceimporter.py 2011-06-21 13:31:33 +0000
+++ stoqlib/importers/serviceimporter.py 2011-11-05 17:07:26 +0000
@@ -57,5 +57,5 @@
57 cost=int(data.cost),57 cost=int(data.cost),
58 code=data.barcode,58 code=data.barcode,
59 barcode=data.barcode)59 barcode=data.barcode)
60 service = Service(sellable=sellable,60 Service(sellable=sellable,
61 connection=trans)61 connection=trans)
6262
=== modified file 'stoqlib/importers/supplierimporter.py'
--- stoqlib/importers/supplierimporter.py 2011-02-08 14:06:58 +0000
+++ stoqlib/importers/supplierimporter.py 2011-11-05 17:07:26 +0000
@@ -61,12 +61,15 @@
61 state=data.state,61 state=data.state,
62 country=data.country)62 country=data.country)
63 streetnumber = data.streetnumber and int(data.streetnumber) or None63 streetnumber = data.streetnumber and int(data.streetnumber) or None
64 address = Address(is_main_address=True,64 Address(
65 person=person, city_location=ctloc,65 is_main_address=True,
66 connection=trans,66 person=person,
67 street=data.street,67 city_location=ctloc,
68 streetnumber=streetnumber,68 connection=trans,
69 district=data.district)69 street=data.street,
70 streetnumber=streetnumber,
71 district=data.district
72 )
7073
71 person.addFacet(ISupplier, connection=trans)74 person.addFacet(ISupplier, connection=trans)
7275
7376
=== modified file 'stoqlib/importers/transporterimporter.py'
--- stoqlib/importers/transporterimporter.py 2011-06-21 13:31:33 +0000
+++ stoqlib/importers/transporterimporter.py 2011-11-05 17:07:26 +0000
@@ -62,12 +62,15 @@
62 state=data.state,62 state=data.state,
63 country=data.country)63 country=data.country)
64 streetnumber = data.streetnumber and int(data.streetnumber) or None64 streetnumber = data.streetnumber and int(data.streetnumber) or None
65 address = Address(is_main_address=True,65 Address(
66 person=person, city_location=ctloc,66 is_main_address=True,
67 connection=trans,67 person=person,
68 street=data.street,68 city_location=ctloc,
69 streetnumber=streetnumber,69 connection=trans,
70 district=data.district)70 street=data.street,
71 streetnumber=streetnumber,
72 district=data.district
73 )
7174
72 dict(open_contract_date=self.parse_date(data.open_contract),75 dict(open_contract_date=self.parse_date(data.open_contract),
73 freight_percentage=data.freight_percentage),76 freight_percentage=data.freight_percentage),
7477
=== modified file 'stoqlib/lib/devicemanager.py'
--- stoqlib/lib/devicemanager.py 2011-04-18 21:23:31 +0000
+++ stoqlib/lib/devicemanager.py 2011-11-05 17:07:26 +0000
@@ -30,6 +30,7 @@
3030
31try:31try:
32 import gudev32 import gudev
33 gudev # pyflakes
33except ImportError:34except ImportError:
34 gudev = None35 gudev = None
3536
3637
=== modified file 'stoqlib/lib/imageutils.py'
--- stoqlib/lib/imageutils.py 2011-09-12 20:14:28 +0000
+++ stoqlib/lib/imageutils.py 2011-11-05 17:07:26 +0000
@@ -31,8 +31,6 @@
31import gtk31import gtk
32import gobject32import gobject
3333
34from kiwi.environ import environ
35
3634
37class ImageHelper(object):35class ImageHelper(object):
3836
3937
=== modified file 'stoqlib/lib/test/test_ofximporter.py'
--- stoqlib/lib/test/test_ofximporter.py 2011-06-17 17:11:48 +0000
+++ stoqlib/lib/test/test_ofximporter.py 2011-11-05 17:07:26 +0000
@@ -24,11 +24,9 @@
24from decimal import Decimal24from decimal import Decimal
25import operator25import operator
2626
27from stoqlib.database.runtime import new_transaction
28from stoqlib.domain.account import Account27from stoqlib.domain.account import Account
29from stoqlib.domain.test.domaintest import DomainTest28from stoqlib.domain.test.domaintest import DomainTest
30from stoqlib.importers.ofximporter import OFXImporter29from stoqlib.importers.ofximporter import OFXImporter
31from stoqlib.lib.parameters import sysparam
3230
3331
34OFX_DATA = """OFXHEADER:10032OFX_DATA = """OFXHEADER:100
@@ -218,7 +216,6 @@
218 ofx.feed(StringIO(OFX_DATA))216 ofx.feed(StringIO(OFX_DATA))
219 ofx.set_dry(True)217 ofx.set_dry(True)
220 ofx.process(self.trans)218 ofx.process(self.trans)
221 imbalance_account = sysparam(self.trans).IMBALANCE_ACCOUNT
222 account = Account.select(connection=self.trans).orderBy('id')[-1]219 account = Account.select(connection=self.trans).orderBy('id')[-1]
223 self.failUnless(account)220 self.failUnless(account)
224 self.assertEquals(account.description, "Bank - CHECKING")221 self.assertEquals(account.description, "Bank - CHECKING")
@@ -236,7 +233,6 @@
236 ofx.feed(StringIO(OFX_DATA2))233 ofx.feed(StringIO(OFX_DATA2))
237 ofx.set_dry(True)234 ofx.set_dry(True)
238 ofx.process(self.trans)235 ofx.process(self.trans)
239 imbalance_account = sysparam(self.trans).IMBALANCE_ACCOUNT
240 account = Account.select(connection=self.trans).orderBy('id')[-1]236 account = Account.select(connection=self.trans).orderBy('id')[-1]
241 self.failUnless(account)237 self.failUnless(account)
242 self.assertEquals(account.description, "Banco do Brasil - CHECKING")238 self.assertEquals(account.description, "Banco do Brasil - CHECKING")
@@ -254,8 +250,6 @@
254 ofx.feed(StringIO(OFX_DATA3))250 ofx.feed(StringIO(OFX_DATA3))
255 ofx.set_dry(True)251 ofx.set_dry(True)
256 ofx.process(self.trans)252 ofx.process(self.trans)
257 imbalance_account = sysparam(self.trans).IMBALANCE_ACCOUNT
258 trans = new_transaction()
259 account = Account.select(connection=self.trans).orderBy('id')[-1]253 account = Account.select(connection=self.trans).orderBy('id')[-1]
260 self.failUnless(account)254 self.failUnless(account)
261 self.assertEquals(account.description, "SANTANDER - CHECKING")255 self.assertEquals(account.description, "SANTANDER - CHECKING")
262256
=== modified file 'stoqlib/lib/test/test_parameters.py'
--- stoqlib/lib/test/test_parameters.py 2011-06-17 20:40:14 +0000
+++ stoqlib/lib/test/test_parameters.py 2011-11-05 17:07:26 +0000
@@ -46,11 +46,11 @@
46 person = Person(name='Jonas', connection=self.trans)46 person = Person(name='Jonas', connection=self.trans)
47 person.addFacet(IIndividual, connection=self.trans)47 person.addFacet(IIndividual, connection=self.trans)
48 role = EmployeeRole(connection=self.trans, name='desenvolvedor')48 role = EmployeeRole(connection=self.trans, name='desenvolvedor')
49 employee = person.addFacet(IEmployee, connection=self.trans,49 person.addFacet(IEmployee, connection=self.trans,
50 role=role)50 role=role)
51 self.salesperson = person.addFacet(ISalesPerson,51 self.salesperson = person.addFacet(ISalesPerson,
52 connection=self.trans)52 connection=self.trans)
53 company = person.addFacet(ICompany, connection=self.trans)53 person.addFacet(ICompany, connection=self.trans)
54 client = person.addFacet(IClient, connection=self.trans)54 client = person.addFacet(IClient, connection=self.trans)
55 self.branch = person.addFacet(IBranch, connection=self.trans)55 self.branch = person.addFacet(IBranch, connection=self.trans)
5656
@@ -100,7 +100,6 @@
100100
101 def testUseLogicQuantity(self):101 def testUseLogicQuantity(self):
102 storable = self.create_storable()102 storable = self.create_storable()
103 param = self.sparam.USE_LOGIC_QUANTITY
104 self.assertEqual(storable._check_logic_quantity(), None)103 self.assertEqual(storable._check_logic_quantity(), None)
105 self.sparam.update_parameter(parameter_name='USE_LOGIC_QUANTITY',104 self.sparam.update_parameter(parameter_name='USE_LOGIC_QUANTITY',
106 value=u'0')105 value=u'0')
107106
=== modified file 'stoqlib/lib/test/test_sintegra.py'
--- stoqlib/lib/test/test_sintegra.py 2008-10-01 16:11:05 +0000
+++ stoqlib/lib/test/test_sintegra.py 2011-11-05 17:07:26 +0000
@@ -20,7 +20,6 @@
20## Foundation, Inc., or visit: http://www.gnu.org/.20## Foundation, Inc., or visit: http://www.gnu.org/.
21##21##
2222
23from cStringIO import StringIO
24import datetime23import datetime
25from decimal import Decimal24from decimal import Decimal
26import os25import os
@@ -40,7 +39,6 @@
40 expected = basename + '-expected.txt'39 expected = basename + '-expected.txt'
41 output = basename + '-output.txt'40 output = basename + '-output.txt'
4241
43 fp = StringIO()
44 sfile.write(output)42 sfile.write(output)
45 expected = os.path.join(test.__path__[0], expected)43 expected = os.path.join(test.__path__[0], expected)
46 retval = diff_files(expected, output)44 retval = diff_files(expected, output)
4745
=== modified file 'stoqlib/lib/test/test_sintegragenerator.py'
--- stoqlib/lib/test/test_sintegragenerator.py 2011-02-08 14:21:07 +0000
+++ stoqlib/lib/test/test_sintegragenerator.py 2011-11-05 17:07:26 +0000
@@ -77,8 +77,8 @@
77 sale.order()77 sale.order()
7878
79 method = PaymentMethod.get_by_name(self.trans, 'money')79 method = PaymentMethod.get_by_name(self.trans, 'money')
80 payment = method.create_inpayment(sale.group,80 method.create_inpayment(sale.group,
81 sale.get_sale_subtotal())81 sale.get_sale_subtotal())
8282
83 sale.confirm()83 sale.confirm()
84 sale.set_paid()84 sale.set_paid()
8585
=== modified file 'stoqlib/lib/xmlrpc.py'
--- stoqlib/lib/xmlrpc.py 2011-09-12 18:10:48 +0000
+++ stoqlib/lib/xmlrpc.py 2011-11-05 17:07:26 +0000
@@ -62,7 +62,7 @@
62 try:62 try:
63 exc = namedAny(exc_name)63 exc = namedAny(exc_name)
64 raise exc(msg)64 raise exc(msg)
65 except Exception, unused:65 except Exception:
66 # In case server/client side is out of sync66 # In case server/client side is out of sync
67 raise Exception(msg)67 raise Exception(msg)
6868
6969
=== modified file 'stoqlib/reporting/product.py'
--- stoqlib/reporting/product.py 2011-07-11 17:33:47 +0000
+++ stoqlib/reporting/product.py 2011-11-05 17:07:26 +0000
@@ -26,7 +26,6 @@
2626
27from decimal import Decimal27from decimal import Decimal
2828
29from stoqlib.database.runtime import get_connection, get_current_branch
30from stoqlib.reporting.template import (SearchResultsReport, PriceReport,29from stoqlib.reporting.template import (SearchResultsReport, PriceReport,
31 ObjectListReport)30 ObjectListReport)
32from stoqlib.reporting.base.tables import ObjectTableColumn as OTC31from stoqlib.reporting.base.tables import ObjectTableColumn as OTC
3332
=== modified file 'stoqlib/reporting/purchase.py'
--- stoqlib/reporting/purchase.py 2011-10-17 19:36:32 +0000
+++ stoqlib/reporting/purchase.py 2011-11-05 17:07:26 +0000
@@ -277,7 +277,6 @@
277 table_line=TABLE_LINE_BLANK, width=730)277 table_line=TABLE_LINE_BLANK, width=730)
278278
279 def _setup_items_table(self):279 def _setup_items_table(self):
280 items = self._order.get_items()
281 # XXX: Stoqlib Reporting try to apply len() on the table data, but280 # XXX: Stoqlib Reporting try to apply len() on the table data, but
282 # Purchase's get_items returns a SelectResult instance (ORMObject)281 # Purchase's get_items returns a SelectResult instance (ORMObject)
283 # that not supports the len operator.282 # that not supports the len operator.
284283
=== modified file 'stoqlib/reporting/sale.py'
--- stoqlib/reporting/sale.py 2011-07-26 13:53:02 +0000
+++ stoqlib/reporting/sale.py 2011-11-05 17:07:26 +0000
@@ -324,8 +324,6 @@
324 if total_amount:324 if total_amount:
325 va = total_amount/sales_qty325 va = total_amount/sales_qty
326 text = _("Sold value per sales %s") % (get_formatted_price(va,))326 text = _("Sold value per sales %s") % (get_formatted_price(va,))
327 total_sellables = sum([item.sale.get_items_total_quantity()
328 for item in self.salesperson_list])
329327
330 self.add_object_table(self.salesperson_list, self._get_columns(),328 self.add_object_table(self.salesperson_list, self._get_columns(),
331 summary_row=summary_row)329 summary_row=summary_row)
332330
=== modified file 'stoqlib/reporting/template.py'
--- stoqlib/reporting/template.py 2011-07-11 17:33:47 +0000
+++ stoqlib/reporting/template.py 2011-11-05 17:07:26 +0000
@@ -379,7 +379,6 @@
379 """379 """
380 conn = get_connection()380 conn = get_connection()
381 branch = get_current_branch(conn)381 branch = get_current_branch(conn)
382 branch_address = branch.person.address
383 logo = _get_logotype_path(conn)382 logo = _get_logotype_path(conn)
384383
385 ns['title'] = self.title384 ns['title'] = self.title
386385
=== modified file 'stoqlib/reporting/tests/test_reporting.py'
--- stoqlib/reporting/tests/test_reporting.py 2011-11-05 16:46:12 +0000
+++ stoqlib/reporting/tests/test_reporting.py 2011-11-05 17:07:26 +0000
@@ -271,18 +271,18 @@
271 storable = product.addFacet(IStorable, connection=self.trans)271 storable = product.addFacet(IStorable, connection=self.trans)
272 storable.increase_stock(100, get_current_branch(self.trans))272 storable.increase_stock(100, get_current_branch(self.trans))
273273
274 source = CommissionSource(sellable=sellable,274 CommissionSource(sellable=sellable,
275 direct_value=Decimal(10),275 direct_value=Decimal(10),
276 installments_value=1,276 installments_value=1,
277 connection=self.trans)277 connection=self.trans)
278278
279 sale.order()279 sale.order()
280280
281 method = PaymentMethod.get_by_name(self.trans, 'money')281 method = PaymentMethod.get_by_name(self.trans, 'money')
282 till = Till.get_last_opened(self.trans)282 till = Till.get_last_opened(self.trans)
283 payment = method.create_inpayment(sale.group,283 method.create_inpayment(sale.group,
284 sale.get_sale_subtotal(),284 sale.get_sale_subtotal(),
285 till=till)285 till=till)
286 sale.confirm()286 sale.confirm()
287 sale.set_paid()287 sale.set_paid()
288288
289289
=== added file 'stoqlib/test/test_pyflakes.py'
--- stoqlib/test/test_pyflakes.py 1970-01-01 00:00:00 +0000
+++ stoqlib/test/test_pyflakes.py 2011-11-05 17:07:26 +0000
@@ -0,0 +1,68 @@
1# -*- coding: utf-8 -*-
2# vi:si:et:sw=4:sts=4:ts=4
3
4##
5## Copyright (C) 2011 Async Open Source <http://www.async.com.br>
6## All rights reserved
7##
8## This program is free software; you can redistribute it and/or modify
9## it under the terms of the GNU General Public License as published by
10## the Free Software Foundation; either version 2 of the License, or
11## (at your option) any later version.
12##
13## This program is distributed in the hope that it will be useful,
14## but WITHOUT ANY WARRANTY; without even the implied warranty of
15## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16## GNU General Public License for more details.
17##
18## You should have received a copy of the GNU General Public License
19## along with this program; if not, write to the Free Software
20## Foundation, Inc., or visit: http://www.gnu.org/.
21##
22## Author(s): Stoq Team <stoq-devel@async.com.br>
23##
24"""Test pyflakes on stoq, stoqlib and plugins directories
25
26Useful to early find syntax errors and other common problems.
27"""
28
29import sys
30import os.path
31
32from twisted.trial import unittest
33try:
34 from pyflakes.scripts import pyflakes
35 pyflakes # pyflakes (ironique ah?)
36except ImportError:
37 pyflakes = None
38
39
40class TestPyflakes(unittest.TestCase):
41
42 def __init__(self, *args, **kwargs):
43 super(TestPyflakes, self).__init__(*args, **kwargs)
44
45 def _test_path(self, path_name):
46 # Skip test if user doesn't have pyflakes installed.
47 if not pyflakes:
48 raise unittest.SkipTest("Pyflakes not installed")
49
50 test_path = None
51 for path in sys.path:
52 if path.endswith('stoq'):
53 test_path = path
54 break
55 self.assertTrue(test_path)
56
57 path = os.path.join(test_path, path_name)
58 retval = pyflakes.main([path])
59 self.assertEqual(retval, 0)
60
61
62for subpath in ('stoq', 'stoqlib', 'plugins'):
63 # subpath has to be passed as a kw, or it will always be plugins (the
64 # last subpath variable on for).
65 func = lambda self, subpath=subpath: self._test_path(subpath)
66 name = 'test_%s_pyflakes' % (subpath,)
67 func.__name__ = name
68 setattr(TestPyflakes, name, func)

Subscribers

People subscribed via source and target branches