Fix pep8 and pyflakes
This commit is contained in:
1 parent
5b1a7e263e
commit
976db08220
3 files changed
+15
-11
No files matched your search
+5
-5
@@ -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',
|
||||
],
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in new issue
Block a user