diff --git a/__tryton__.py b/__tryton__.py index 078b813b50..707c706d02 100644 --- a/__tryton__.py +++ b/__tryton__.py @@ -2,13 +2,13 @@ #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' : 'Purchase Shipment Cost', - 'version' : '2.3.0', - 'author' : 'B2CK', + 'name': 'Purchase Shipment Cost', + 'version': '2.3.0', + 'author': 'B2CK', 'email': 'info@b2ck.com', 'website': 'http://www.tryton.org/', 'description': 'Add purchase shipment cost', - 'depends' : [ + 'depends': [ 'ir', 'res', 'carrier', @@ -19,7 +19,7 @@ 'account_stock_continental', 'account_product', ], - 'xml' : [ + 'xml': [ 'stock.xml', 'carrier.xml', ], diff --git a/stock.py b/stock.py index a64722b58d..02fa6bc5a6 100644 --- a/stock.py +++ b/stock.py @@ -120,7 +120,7 @@ class ShipmentIn(Model): costs = [] digit = move_obj.unit_price.digits[1] - exp = Decimal(str(10.0**-digit)) + exp = Decimal(str(10.0 ** -digit)) difference = cost for move in moves: quantity = Decimal(str(move.quantity)) @@ -145,9 +145,11 @@ class ShipmentIn(Model): for cost in costs: move = cost['move'] - unit_shipment_cost = currency_obj.compute(shipment.company.currency, - cost['unit_shipment_cost'], move.currency, round=False) - unit_shipment_cost = unit_shipment_cost.quantize(exp, rounding=ROUND_HALF_EVEN) + unit_shipment_cost = currency_obj.compute( + shipment.company.currency, cost['unit_shipment_cost'], + move.currency, round=False) + unit_shipment_cost = unit_shipment_cost.quantize( + exp, rounding=ROUND_HALF_EVEN) move_obj.write(move.id, { 'unit_price': move.unit_price + cost['unit_shipment_cost'], 'unit_shipment_cost': cost['unit_shipment_cost'], @@ -159,7 +161,8 @@ class ShipmentIn(Model): carrier_obj = Pool().get('carrier') for shipment in self.browse(ids): if shipment.carrier: - allocation_method = shipment.carrier.carrier_cost_allocation_method + allocation_method = \ + shipment.carrier.carrier_cost_allocation_method else: allocation_method = carrier_obj.default_carrier_cost_method() getattr(self, 'allocate_cost_by_%s' % allocation_method)(shipment) diff --git a/tests/test_purchase_shipment_cost.py b/tests/test_purchase_shipment_cost.py index 0a91327195..7509d67e49 100644 --- a/tests/test_purchase_shipment_cost.py +++ b/tests/test_purchase_shipment_cost.py @@ -1,7 +1,8 @@ #!/usr/bin/env python #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):