Migrate to python 3
This commit is contained in:
parent
c7edcc0186
commit
4b77d48795
4
setup.py
4
setup.py
|
@ -4,7 +4,7 @@
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
import ConfigParser
|
import configparser
|
||||||
|
|
||||||
MODULE = 'stock_lot_cost'
|
MODULE = 'stock_lot_cost'
|
||||||
PREFIX = 'nantic'
|
PREFIX = 'nantic'
|
||||||
|
@ -23,7 +23,7 @@ def get_require_version(name):
|
||||||
major_version, minor_version + 1)
|
major_version, minor_version + 1)
|
||||||
return require
|
return require
|
||||||
|
|
||||||
config = ConfigParser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.readfp(open('tryton.cfg'))
|
config.readfp(open('tryton.cfg'))
|
||||||
info = dict(config.items('tryton'))
|
info = dict(config.items('tryton'))
|
||||||
for key in ('depends', 'extras_depend', 'xml'):
|
for key in ('depends', 'extras_depend', 'xml'):
|
||||||
|
|
13
stock.py
13
stock.py
|
@ -10,7 +10,6 @@ from trytond.modules.product import price_digits
|
||||||
|
|
||||||
__all__ = ['LotCostCategory', 'LotCostLine', 'Lot', 'Move', 'Product',
|
__all__ = ['LotCostCategory', 'LotCostLine', 'Lot', 'Move', 'Product',
|
||||||
'Location']
|
'Location']
|
||||||
__metaclass__ = PoolMeta
|
|
||||||
|
|
||||||
|
|
||||||
class LotCostCategory(ModelSQL, ModelView):
|
class LotCostCategory(ModelSQL, ModelView):
|
||||||
|
@ -60,7 +59,7 @@ class LotCostLine(ModelSQL, ModelView):
|
||||||
return [('', '')] + [(m.model, m.name) for m in models]
|
return [('', '')] + [(m.model, m.name) for m in models]
|
||||||
|
|
||||||
|
|
||||||
class Lot:
|
class Lot(metaclass=PoolMeta):
|
||||||
__name__ = 'stock.lot'
|
__name__ = 'stock.lot'
|
||||||
|
|
||||||
cost_lines = fields.One2Many('stock.lot.cost_line', 'lot', 'Cost Lines')
|
cost_lines = fields.One2Many('stock.lot.cost_line', 'lot', 'Cost Lines')
|
||||||
|
@ -107,7 +106,7 @@ class Lot:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class Move:
|
class Move(metaclass=PoolMeta):
|
||||||
__name__ = 'stock.move'
|
__name__ = 'stock.move'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -116,7 +115,7 @@ class Move:
|
||||||
cls.lot.context['from_move'] = Eval('id')
|
cls.lot.context['from_move'] = Eval('id')
|
||||||
|
|
||||||
|
|
||||||
class Product:
|
class Product(metaclass=PoolMeta):
|
||||||
__name__ = 'product.product'
|
__name__ = 'product.product'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -137,7 +136,7 @@ class Product:
|
||||||
product_ids=product_by_id.keys(), with_childs=True,
|
product_ids=product_by_id.keys(), with_childs=True,
|
||||||
grouping=('product', 'lot'))
|
grouping=('product', 'lot'))
|
||||||
|
|
||||||
for (location_id, product_id, lot_id), qty in pbl.iteritems():
|
for (location_id, product_id, lot_id), qty in pbl.items():
|
||||||
cost_value = None
|
cost_value = None
|
||||||
if lot_id:
|
if lot_id:
|
||||||
lot = Lot(lot_id)
|
lot = Lot(lot_id)
|
||||||
|
@ -155,7 +154,7 @@ class Product:
|
||||||
return cost_values
|
return cost_values
|
||||||
|
|
||||||
|
|
||||||
class Location:
|
class Location(metaclass=PoolMeta):
|
||||||
__name__ = 'stock.location'
|
__name__ = 'stock.location'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -191,7 +190,7 @@ class Location:
|
||||||
grouping=('product', 'lot'))
|
grouping=('product', 'lot'))
|
||||||
|
|
||||||
cost_values = dict((l.id, None) for l in locations)
|
cost_values = dict((l.id, None) for l in locations)
|
||||||
for key, qty in pbl.iteritems():
|
for key, qty in pbl.items():
|
||||||
if len(key) != 3:
|
if len(key) != 3:
|
||||||
continue
|
continue
|
||||||
location_id, product_id, lot_id = key
|
location_id, product_id, lot_id = key
|
||||||
|
|
Loading…
Reference in New Issue