Fix pep8 and pyflakes
This commit is contained in:
+4
-4
@@ -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).
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
+4
-2
@@ -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()
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user