Migrate to python 3
This commit is contained in:
parent
9b4d4bbc93
commit
f1ba1fba51
|
@ -5,10 +5,9 @@ from trytond.pyson import Eval, Get, If, Bool
|
||||||
from trytond.pool import Pool, PoolMeta
|
from trytond.pool import Pool, PoolMeta
|
||||||
|
|
||||||
__all__ = ['ProductBom']
|
__all__ = ['ProductBom']
|
||||||
__metaclass__ = PoolMeta
|
|
||||||
|
|
||||||
|
|
||||||
class ProductBom:
|
class ProductBom(metaclass=PoolMeta):
|
||||||
__name__ = 'product.product-production.bom'
|
__name__ = 'product.product-production.bom'
|
||||||
|
|
||||||
process = fields.Many2One('production.process', 'Process',
|
process = fields.Many2One('production.process', 'Process',
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from itertools import izip
|
|
||||||
from trytond.model import ModelSQL, ModelView, fields
|
from trytond.model import ModelSQL, ModelView, fields
|
||||||
from trytond.pool import Pool, PoolMeta
|
from trytond.pool import Pool, PoolMeta
|
||||||
from trytond.pyson import Bool, Eval
|
from trytond.pyson import Bool, Eval
|
||||||
|
@ -8,7 +8,6 @@ from trytond.transaction import Transaction
|
||||||
|
|
||||||
__all__ = ['Process', 'Step', 'BOMInput', 'BOMOutput', 'Operation', 'BOM',
|
__all__ = ['Process', 'Step', 'BOMInput', 'BOMOutput', 'Operation', 'BOM',
|
||||||
'Route', 'Production', 'StockMove']
|
'Route', 'Production', 'StockMove']
|
||||||
__metaclass__ = PoolMeta
|
|
||||||
|
|
||||||
|
|
||||||
class Process(ModelSQL, ModelView):
|
class Process(ModelSQL, ModelView):
|
||||||
|
@ -90,7 +89,7 @@ class Process(ModelSQL, ModelView):
|
||||||
if without_boms:
|
if without_boms:
|
||||||
boms = BOM.create(boms_to_create)
|
boms = BOM.create(boms_to_create)
|
||||||
routes = Route.create(routes_to_create)
|
routes = Route.create(routes_to_create)
|
||||||
for values, bom, route in izip(without_boms, boms, routes):
|
for values, bom, route in zip(without_boms, boms, routes):
|
||||||
values['bom'] = bom.id
|
values['bom'] = bom.id
|
||||||
values['route'] = route.id
|
values['route'] = route.id
|
||||||
return super(Process, cls).create(with_boms + without_boms)
|
return super(Process, cls).create(with_boms + without_boms)
|
||||||
|
@ -223,7 +222,7 @@ class Step(ModelSQL, ModelView):
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
class BOMMixin:
|
class BOMMixin(metaclass=PoolMeta):
|
||||||
step = fields.Many2One('production.process.step', 'Step')
|
step = fields.Many2One('production.process.step', 'Step')
|
||||||
step_sequence = fields.Integer('Step Sequence')
|
step_sequence = fields.Integer('Step Sequence')
|
||||||
|
|
||||||
|
@ -245,7 +244,7 @@ class BOMOutput(BOMMixin):
|
||||||
__name__ = 'production.bom.output'
|
__name__ = 'production.bom.output'
|
||||||
|
|
||||||
|
|
||||||
class Operation:
|
class Operation(metaclass=PoolMeta):
|
||||||
__name__ = 'production.route.operation'
|
__name__ = 'production.route.operation'
|
||||||
step = fields.Many2One('production.process.step', 'Step')
|
step = fields.Many2One('production.process.step', 'Step')
|
||||||
|
|
||||||
|
@ -289,7 +288,7 @@ class Operation:
|
||||||
return step.process.route.id
|
return step.process.route.id
|
||||||
|
|
||||||
|
|
||||||
class BOM:
|
class BOM(metaclass=PoolMeta):
|
||||||
__name__ = 'production.bom'
|
__name__ = 'production.bom'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -314,7 +313,7 @@ class BOM:
|
||||||
super(BOM, cls).delete(boms)
|
super(BOM, cls).delete(boms)
|
||||||
|
|
||||||
|
|
||||||
class Route:
|
class Route(metaclass=PoolMeta):
|
||||||
__name__ = 'production.route'
|
__name__ = 'production.route'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -340,7 +339,7 @@ class Route:
|
||||||
super(Route, cls).delete(routes)
|
super(Route, cls).delete(routes)
|
||||||
|
|
||||||
|
|
||||||
class Production:
|
class Production(metaclass=PoolMeta):
|
||||||
__name__ = 'production'
|
__name__ = 'production'
|
||||||
|
|
||||||
process = fields.Many2One('production.process', 'Process',
|
process = fields.Many2One('production.process', 'Process',
|
||||||
|
@ -394,7 +393,7 @@ class Production:
|
||||||
return move
|
return move
|
||||||
|
|
||||||
|
|
||||||
class StockMove:
|
class StockMove(metaclass=PoolMeta):
|
||||||
__name__ = 'stock.move'
|
__name__ = 'stock.move'
|
||||||
|
|
||||||
production_step = fields.Many2One('production.process.step', 'Process')
|
production_step = fields.Many2One('production.process.step', 'Process')
|
||||||
|
|
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 = 'production_process'
|
MODULE = 'production_process'
|
||||||
PREFIX = 'nantic'
|
PREFIX = 'nantic'
|
||||||
|
@ -14,7 +14,7 @@ MODULE2PREFIX = {}
|
||||||
def read(fname):
|
def read(fname):
|
||||||
return open(os.path.join(os.path.dirname(__file__), fname)).read()
|
return open(os.path.join(os.path.dirname(__file__), fname)).read()
|
||||||
|
|
||||||
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'):
|
||||||
|
|
|
@ -200,7 +200,7 @@ Create an Inventory::
|
||||||
>>> inventory.save()
|
>>> inventory.save()
|
||||||
>>> Inventory.confirm([inventory.id], config.context)
|
>>> Inventory.confirm([inventory.id], config.context)
|
||||||
>>> inventory.state
|
>>> inventory.state
|
||||||
u'done'
|
'done'
|
||||||
|
|
||||||
Make a production::
|
Make a production::
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ Make a production::
|
||||||
>>> production.reload()
|
>>> production.reload()
|
||||||
>>> output, = production.outputs
|
>>> output, = production.outputs
|
||||||
>>> output.state
|
>>> output.state
|
||||||
u'done'
|
'done'
|
||||||
>>> config._context['locations'] = [storage.id]
|
>>> config._context['locations'] = [storage.id]
|
||||||
>>> product = Product(product.id)
|
>>> product = Product(product.id)
|
||||||
>>> product.quantity == 2
|
>>> product.quantity == 2
|
||||||
|
|
Loading…
Reference in New Issue