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