From bbe639d663c9717c739da18f582ca421c140ffdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 3 Apr 2012 20:07:18 +0200 Subject: [PATCH] Fix pep8 and pyflakes --- __tryton__.py | 13 ++++++------- category.py | 3 ++- tests/test_product.py | 6 ++++-- uom.py | 1 + 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/__tryton__.py b/__tryton__.py index 0fa65f6e23..ca60022b42 100644 --- a/__tryton__.py +++ b/__tryton__.py @@ -2,7 +2,7 @@ #This file is part of Tryton. The COPYRIGHT file at the top level of #this repository contains the full copyright notices and license terms. { - 'name' : 'Product', + 'name': 'Product', 'name_bg_BG': 'Продукт', 'name_ca_ES': 'Productes', 'name_de_DE': 'Artikel', @@ -11,8 +11,8 @@ 'name_fr_FR': 'Produit', 'name_nl_NL': 'Producten', 'name_ru_RU': 'ТМЦ', - 'version' : '2.3.0', - 'author' : 'B2CK', + 'version': '2.3.0', + 'author': 'B2CK', 'email': 'info@b2ck.com', 'website': 'http://www.tryton.org/', 'description': 'Define products, categories of product, units ' \ @@ -29,13 +29,13 @@ de mesura, categories d'unitats de mesura.''', - Unité de mesure - Catégorie d'unité de mesure ''', - 'description_nl_NL': 'Definieert producten, productcategorieën, meeteenheden en categorieën van meeteenheden.', + 'description_nl_NL': 'Definieert producten, productcategorieën, meeteenheden en categorieën van meeteenheden.', 'description_ru_RU': 'Определение ТМЦ, категорий ТМЦ, единиц измерения, категорий единиц измерения.', - 'depends' : [ + 'depends': [ 'ir', 'res', ], - 'xml' : [ + 'xml': [ 'product.xml', 'category.xml', 'uom.xml', @@ -52,4 +52,3 @@ de mesura, categories d'unitats de mesura.''', 'locale/ru_RU.po', ] } - diff --git a/category.py b/category.py index b06f4b01ae..40ebe0ef69 100644 --- a/category.py +++ b/category.py @@ -9,7 +9,7 @@ class Category(ModelSQL, ModelView): _description = __doc__ name = fields.Char('Name', required=True, translate=True) - parent = fields.Many2One('product.category','Parent', select=True) + parent = fields.Many2One('product.category', 'Parent', select=True) childs = fields.One2Many('product.category', 'parent', string='Children') @@ -28,6 +28,7 @@ class Category(ModelSQL, ModelView): if not ids: return {} res = {} + def _name(category): if category.id in res: return res[category.id] diff --git a/tests/test_product.py b/tests/test_product.py index e408cdec7b..748f853515 100644 --- a/tests/test_product.py +++ b/tests/test_product.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): @@ -15,6 +16,7 @@ from trytond.tests.test_tryton import POOL, DB_NAME, USER, CONTEXT, test_view,\ test_depends from trytond.transaction import Transaction + class ProductTestCase(unittest.TestCase): ''' Test Product module. @@ -133,7 +135,6 @@ class ProductTestCase(unittest.TestCase): uom = self.uom.browse(uom_id) self.assert_(result == self.uom.select_accurate_field(uom)) - def test0040uom_compute_qty(self): ''' Test uom compute_qty function. @@ -191,6 +192,7 @@ class ProductTestCase(unittest.TestCase): self.assert_(result == self.uom.compute_price(from_uom, price, to_uom)) + def suite(): suite = trytond.tests.test_tryton.suite() suite.addTests(unittest.TestLoader().loadTestsFromTestCase( diff --git a/uom.py b/uom.py index 5bf3bba392..04501a3d65 100644 --- a/uom.py +++ b/uom.py @@ -10,6 +10,7 @@ STATES = { } DEPENDS = ['active'] + class UomCategory(ModelSQL, ModelView): 'Product uom category' _name = 'product.uom.category'