From f52e121b00f00f5f66bb321522aba509fad2245d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 3 Apr 2012 20:06:31 +0200 Subject: [PATCH] Fix pep8 and pyflakes --- __tryton__.py | 2 +- product.py | 1 - stock.py | 12 +++++++----- tests/test_account_stock_continental.py | 10 +++++++--- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/__tryton__.py b/__tryton__.py index 4b76870420..f63944b56e 100644 --- a/__tryton__.py +++ b/__tryton__.py @@ -11,7 +11,7 @@ 'website': 'http://www.tryton.org/', 'description': '''Add continental stock accounting for real-time stock valuation. ''', - 'description_ca_ES': '''Afegeix comptabilitat d'estocs continental per + 'description_ca_ES': '''Afegeix comptabilitat d'estocs continental per la valoració d'estocs en temps real.''', 'description_de_DE': ''' - Fügt die kontinentale Methode der Lagerbewertung in Echt-Zeit hinzu. diff --git a/product.py b/product.py index 5bec2bfe09..7251aec409 100644 --- a/product.py +++ b/product.py @@ -132,4 +132,3 @@ class Template(ModelSQL, ModelView): 'account.account', 'Account Stock Lost and Found'), 'get_account') Template() - diff --git a/stock.py b/stock.py index 1421973ae0..aaf0ec0bf9 100644 --- a/stock.py +++ b/stock.py @@ -1,11 +1,11 @@ #This file is part of Tryton. The COPYRIGHT file at the top level of #this repository contains the full copyright notices and license terms. from decimal import Decimal -from trytond.model import Model, ModelView, ModelSQL, fields +from trytond.model import Model, fields from trytond.pool import Pool -class Move(ModelSQL, ModelView): +class Move(Model): _name = 'stock.move' account_move = fields.Many2One('account.move', 'Account Move', @@ -17,7 +17,8 @@ class Move(ModelSQL, ModelView): ''' uom_obj = Pool().get('product.uom') currency_obj = Pool().get('currency.currency') - assert type_.startswith('in_') or type_.startswith('out_'), 'wrong type' + assert type_.startswith('in_') or type_.startswith('out_'), \ + 'wrong type' move_line = { 'name': move.rec_name, @@ -115,7 +116,7 @@ class Move(ModelSQL, ModelView): if not type_: return assert not move.account_move, 'account move field not empty' - if type_ == 'supplier_customer': + if type_ == 'supplier_customer': account_move_lines = self._get_account_stock_move_lines(move, 'in_supplier') account_move_lines.extend(self._get_account_stock_move_lines(move, @@ -126,7 +127,8 @@ class Move(ModelSQL, ModelView): account_move_lines.extend(self._get_account_stock_move_lines(move, 'out_supplier')) else: - account_move_lines = self._get_account_stock_move_lines(move, type_) + account_move_lines = self._get_account_stock_move_lines(move, + type_) amount = Decimal('0.0') for line in account_move_lines: diff --git a/tests/test_account_stock_continental.py b/tests/test_account_stock_continental.py index 709c50f03b..1a466acc7c 100644 --- a/tests/test_account_stock_continental.py +++ b/tests/test_account_stock_continental.py @@ -2,7 +2,8 @@ #This file is part of Tryton. The COPYRIGHT file at the top level of #this repository contains the full copyright notices and license terms. -import sys, os +import sys +import os DIR = os.path.abspath(os.path.normpath(os.path.join(__file__, '..', '..', '..', '..', '..', 'trytond'))) if os.path.isdir(DIR): @@ -35,6 +36,7 @@ class AccountStockContinentalTestCase(unittest.TestCase): ''' test_depends() + def doctest_dropdb(test): ''' Remove sqlite memory database @@ -47,12 +49,14 @@ def doctest_dropdb(test): finally: cursor.close() + def suite(): suite = trytond.tests.test_tryton.suite() suite.addTests(unittest.TestLoader().loadTestsFromTestCase( AccountStockContinentalTestCase)) - suite.addTests(doctest.DocFileSuite('scenario_account_stock_continental.rst', - setUp=doctest_dropdb, tearDown=doctest_dropdb, encoding='utf-8', + suite.addTests(doctest.DocFileSuite( + 'scenario_account_stock_continental.rst', + setUp=doctest_dropdb, tearDown=doctest_dropdb, encoding='utf-8', optionflags=doctest.REPORT_ONLY_FIRST_FAILURE)) return suite