Migrate to python 3

This commit is contained in:
Albert Cervera i Areny 2018-09-04 00:21:09 +02:00
parent 31b92b3642
commit 53a5ab5395
5 changed files with 9 additions and 13 deletions

View file

@ -22,8 +22,7 @@ def process_sale(func):
return wrapper
class Production:
__metaclass__ = PoolMeta
class Production(metaclass=PoolMeta):
__name__ = 'production'
sale_exception_state = fields.Function(fields.Selection([

View file

@ -10,8 +10,7 @@ from trytond.transaction import Transaction
__all__ = ['PurchaseRequest']
class PurchaseRequest:
__metaclass__ = PoolMeta
class PurchaseRequest(metaclass=PoolMeta):
__name__ = 'purchase.request'
@classmethod

View file

@ -13,8 +13,7 @@ __all__ = ['Sale', 'SaleLine',
'HandleProductionExceptionAsk', 'HandleProductionException']
class Sale:
__metaclass__ = PoolMeta
class Sale(metaclass=PoolMeta):
__name__ = 'sale.sale'
production_state = fields.Selection([
@ -114,8 +113,7 @@ class Sale:
return production_by_line
class SaleLine:
__metaclass__ = PoolMeta
class SaleLine(metaclass=PoolMeta):
__name__ = 'sale.line'
productions = fields.One2Many('production', 'origin', 'Productions',

View file

@ -4,7 +4,7 @@
from setuptools import setup
import re
import os
import ConfigParser
import configparser
MODULE = 'sale_product_raw'
PREFIX = 'nantic'
@ -14,7 +14,7 @@ MODULE2PREFIX = {}
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
config = ConfigParser.ConfigParser()
config = configparser.ConfigParser()
config.readfp(open('tryton.cfg'))
info = dict(config.items('tryton'))
for key in ('depends', 'extras_depend', 'xml'):

View file

@ -125,7 +125,7 @@ Sale services::
>>> service_sale.click('confirm')
>>> service_sale.click('process')
>>> service_sale.state
u'processing'
'processing'
>>> service_invoice, = service_sale.invoices
>>> service_sale.productions == []
True
@ -146,13 +146,13 @@ Sale 5 products::
>>> sale.click('confirm')
>>> sale.click('process')
>>> sale.state
u'processing'
'processing'
>>> sale.reload()
>>> len(sale.shipments), len(sale.shipment_returns), len(sale.productions)
(1, 0, 1)
>>> production, = sale.productions
>>> production.state
u'draft'
'draft'
>>> input, = production.inputs
>>> input.product == raw_product
True