From 5b2d98d4c35a0ba53c237fa00f1a3eb779ccebbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 3 Apr 2012 20:07:21 +0200 Subject: [PATCH] Fix pep8 and pyflakes --- __tryton__.py | 8 ++++---- move.py | 7 +++---- product.py | 6 ++++-- tests/test_product_cost_fifo.py | 5 ++++- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/__tryton__.py b/__tryton__.py index 6956f76ac4..7424a50d67 100644 --- a/__tryton__.py +++ b/__tryton__.py @@ -17,7 +17,7 @@ Once installed, the price of the stock moves from a supplier or to a customer will update automatically the cost price of the related product (if the cost price method is FIFO) ''', - 'description_bg_BG':'''Добавя FIFO начин на остойностяване в формата на продукт + 'description_bg_BG': '''Добавя FIFO начин на остойностяване в формата на продукт - Добавя FIFO (първи влязъл първи излязъл) като начин на изчисляване на цената на продукт. - След инсталиране на този модул цената на даден продукт (ако е избран този @@ -25,11 +25,11 @@ product (if the cost price method is FIFO) наличност от доставчик или към клиент ''', 'description_ca_ES': '''Afegeix el mètode de cost FIFO al formulari de producte. -Un cop instal·lat, el preu dels moviments d'estoc des d'un proveïdor o un client, +Un cop instal·lat, el preu dels moviments d'estoc des d'un proveïdor o un client, actualitzarà automàticament el preu de cost del producte relacionat (si el mètode de càlcul del preu de cost és FIFO). ''', - 'description_de_DE':'''Kostenpreisermittlung für Artikel nach Methode 'FIFO' + 'description_de_DE': '''Kostenpreisermittlung für Artikel nach Methode 'FIFO' - Fügt 'FIFO' (First In - First Out) zu den Methoden für die Kostenpreisermittlung für Artikel hinzu. - Nach Installation dieses Moduls wird der Kostenpreis eines Artikels (für @@ -46,7 +46,7 @@ Una vez instalado, el precio de los movimientos de stock desde un proveedor o a un cliente actualizará automáticamente el precio de coste del producto relacionado (si el método de cálculo del precio de coste es FIFO) ''', - 'description_fr_FR':'''Ajoute 'FIFO' parmi les méthodes de coût du produit. + 'description_fr_FR': '''Ajoute 'FIFO' parmi les méthodes de coût du produit. Une fois le module installé, le prix de chaque mouvement de stock depuis un fournisseur ou vers un client modifiera automatiquement le prix de revient du produit concerné (si la méthode de coût est FIFO). diff --git a/move.py b/move.py index b00b155079..2ae8060fd8 100644 --- a/move.py +++ b/move.py @@ -27,7 +27,8 @@ class Move(ModelSQL, ModelView): def default_fifo_quantity(self): return 0.0 - def _update_fifo_out_product_cost_price(self, product, quantity, uom, date): + def _update_fifo_out_product_cost_price(self, product, quantity, uom, + date): ''' Update the product cost price of the given product. Update fifo_quantity on the concerned incomming moves. Return the @@ -51,7 +52,6 @@ class Move(ModelSQL, ModelView): fifo_moves = template_obj.get_fifo_move(product.template.id, total_qty) - cost_price = Decimal("0.0") consumed_qty = 0.0 for move, move_qty in fifo_moves: @@ -71,14 +71,13 @@ class Move(ModelSQL, ModelView): 'fifo_quantity': (move.fifo_quantity or 0.0) + move_qty, }) - if Decimal(str(consumed_qty)) != Decimal("0"): cost_price = cost_price / Decimal(str(consumed_qty)) if cost_price != Decimal("0"): digits = self.cost_price.digits return cost_price.quantize( - Decimal(str(10.0**-digits[1]))) + Decimal(str(10.0 ** -digits[1]))) else: return product.cost_price diff --git a/product.py b/product.py index d904fb4fb5..197574a220 100644 --- a/product.py +++ b/product.py @@ -67,9 +67,11 @@ class Template(ModelSQL, ModelView): if avail_qty <= quantity: if avail_qty > 0.0: - fifo_moves.append((move, min(qty, quantity - avail_qty))) + fifo_moves.append( + (move, min(qty, quantity - avail_qty))) else: - fifo_moves.append((move, min(quantity, qty + avail_qty))) + fifo_moves.append( + (move, min(quantity, qty + avail_qty))) break fifo_moves.reverse() diff --git a/tests/test_product_cost_fifo.py b/tests/test_product_cost_fifo.py index 3a3dde71cf..c1d2f3688b 100644 --- a/tests/test_product_cost_fifo.py +++ b/tests/test_product_cost_fifo.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): @@ -12,6 +13,7 @@ import unittest import trytond.tests.test_tryton from trytond.tests.test_tryton import test_depends + class ProductCostFIFOTestCase(unittest.TestCase): ''' Test ProductCostFIFO module. @@ -23,6 +25,7 @@ class ProductCostFIFOTestCase(unittest.TestCase): def test0006depends(self): test_depends() + def suite(): suite = trytond.tests.test_tryton.suite() suite.addTests(unittest.TestLoader().loadTestsFromTestCase(