Migrate to python 3.
This commit is contained in:
parent
5c424885cf
commit
57392d62e0
|
@ -13,9 +13,8 @@ __all__ = ['Party', 'PurchaseRequest', 'BOM', 'Production', 'Purchase',
|
|||
'PartyProductionWarehouse']
|
||||
|
||||
|
||||
class Party(MultiValueMixin):
|
||||
class Party(MultiValueMixin, metaclass=PoolMeta):
|
||||
__name__ = 'party.party'
|
||||
__metaclass__ = PoolMeta
|
||||
production_warehouse = fields.MultiValue(fields.Many2One('stock.location',
|
||||
'Production Warehouse', domain=[
|
||||
('type', '=', 'warehouse'),
|
||||
|
@ -66,9 +65,8 @@ class PartyProductionWarehouse(ModelSQL, ValueMixin):
|
|||
parent='party', fields=fields)
|
||||
|
||||
|
||||
class PurchaseRequest:
|
||||
class PurchaseRequest(metaclass=PoolMeta):
|
||||
__name__ = 'purchase.request'
|
||||
__metaclass__ = PoolMeta
|
||||
|
||||
@classmethod
|
||||
def get_origin(cls):
|
||||
|
@ -82,9 +80,8 @@ class PurchaseRequest:
|
|||
return res
|
||||
|
||||
|
||||
class BOM:
|
||||
class BOM(metaclass=PoolMeta):
|
||||
__name__ = 'production.bom'
|
||||
__metaclass__ = PoolMeta
|
||||
subcontract_product = fields.Many2One('product.product',
|
||||
'Subcontract Product', domain=[
|
||||
('purchasable', '=', True),
|
||||
|
@ -93,9 +90,8 @@ class BOM:
|
|||
|
||||
# TODO: Subcontract cost must be added to the cost of the production
|
||||
|
||||
class Production:
|
||||
class Production(metaclass=PoolMeta):
|
||||
__name__ = 'production'
|
||||
__metaclass__ = PoolMeta
|
||||
|
||||
subcontract_product = fields.Many2One('product.product',
|
||||
'Subcontract Product', domain=[
|
||||
|
@ -301,9 +297,8 @@ class Production:
|
|||
|
||||
# TODO: Internal shipment should be updated each time outputs are changed
|
||||
|
||||
class Purchase:
|
||||
class Purchase(metaclass=PoolMeta):
|
||||
__name__ = 'purchase.purchase'
|
||||
__metaclass__ = PoolMeta
|
||||
|
||||
@classmethod
|
||||
def process(cls, purchases):
|
||||
|
|
5
setup.py
5
setup.py
|
@ -5,10 +5,7 @@ from setuptools import setup
|
|||
import re
|
||||
import os
|
||||
import io
|
||||
try:
|
||||
from configparser import ConfigParser
|
||||
except ImportError:
|
||||
from ConfigParser import ConfigParser
|
||||
from configparser import ConfigParser
|
||||
|
||||
MODULE = 'production_subcontract'
|
||||
PREFIX = 'nantic'
|
||||
|
|
|
@ -207,7 +207,7 @@ Create an Inventory::
|
|||
>>> inventory.save()
|
||||
>>> Inventory.confirm([inventory.id], config.context)
|
||||
>>> inventory.state
|
||||
u'done'
|
||||
'done'
|
||||
|
||||
Create a Supplier Inventory::
|
||||
|
||||
|
@ -229,7 +229,7 @@ Create a Supplier Inventory::
|
|||
>>> inventory.save()
|
||||
>>> Inventory.confirm([inventory.id], config.context)
|
||||
>>> inventory.state
|
||||
u'done'
|
||||
'done'
|
||||
|
||||
Make a production::
|
||||
|
||||
|
@ -249,7 +249,7 @@ Make a production::
|
|||
Decimal('25.0000')
|
||||
>>> Production.wait([production.id], config.context)
|
||||
>>> production.state
|
||||
u'waiting'
|
||||
'waiting'
|
||||
>>> Production.assign_try([production.id], config.context)
|
||||
True
|
||||
>>> production.reload()
|
||||
|
@ -265,7 +265,7 @@ Make a production::
|
|||
>>> production.reload()
|
||||
>>> output, = production.outputs
|
||||
>>> output.state
|
||||
u'done'
|
||||
'done'
|
||||
>>> output.effective_date == production.effective_date
|
||||
True
|
||||
>>> config._context['locations'] = [warehouse.id]
|
||||
|
@ -293,7 +293,7 @@ Make a subcontract production::
|
|||
>>> Production.wait([production.id], config.context)
|
||||
>>> production.reload()
|
||||
>>> production.state
|
||||
u'waiting'
|
||||
'waiting'
|
||||
>>> Production.create_purchase_request([production.id], config.context)
|
||||
>>> production.reload()
|
||||
>>> purchase_request = production.purchase_request
|
||||
|
@ -308,15 +308,11 @@ Make a subcontract production::
|
|||
>>> Purchase.quote([purchase.id], config.context)
|
||||
>>> purchase.reload()
|
||||
>>> purchase.state
|
||||
u'quotation'
|
||||
'quotation'
|
||||
>>> Purchase.confirm([purchase.id], config.context)
|
||||
>>> purchase.reload()
|
||||
>>> purchase.state
|
||||
u'confirmed'
|
||||
>>> Purchase.process([purchase.id], config.context)
|
||||
>>> purchase.reload()
|
||||
>>> purchase.state
|
||||
u'processing'
|
||||
'processing'
|
||||
>>> production.reload()
|
||||
>>> production.incoming_shipment.id
|
||||
1
|
||||
|
@ -324,16 +320,16 @@ Make a subcontract production::
|
|||
>>> Internal.wait([internal.id], config.context)
|
||||
>>> internal.reload()
|
||||
>>> internal.state
|
||||
u'waiting'
|
||||
'waiting'
|
||||
>>> Internal.assign_try([internal.id], config.context)
|
||||
True
|
||||
>>> Internal.done([internal.id], config.context)
|
||||
>>> internal.reload()
|
||||
>>> internal.state
|
||||
u'done'
|
||||
'done'
|
||||
>>> Production.assign_try([production.id], config.context)
|
||||
True
|
||||
>>> Production.run([production.id], config.context)
|
||||
>>> production.reload()
|
||||
>>> production.state
|
||||
u'running'
|
||||
'running'
|
||||
|
|
Loading…
Reference in New Issue