Migrate to python 3

This commit is contained in:
Albert Cervera i Areny 2018-10-29 01:16:37 +01:00
parent 43f800a3d7
commit 1d04ef5dd6
3 changed files with 7 additions and 8 deletions

View file

@ -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_external_reception_lot' MODULE = 'stock_external_reception_lot'
PREFIX = 'nantic' PREFIX = 'nantic'
@ -24,7 +24,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'):

View file

@ -5,10 +5,9 @@ from trytond.pool import PoolMeta
from trytond.pyson import Eval from trytond.pyson import Eval
__all__ = ['ExternalReceptionLine'] __all__ = ['ExternalReceptionLine']
__metaclass__ = PoolMeta
class ExternalReceptionLine: class ExternalReceptionLine(metaclass=PoolMeta):
__name__ = 'stock.external.reception.line' __name__ = 'stock.external.reception.line'
lot_number = fields.Char('Lot Number') lot_number = fields.Char('Lot Number')
lot = fields.Many2One('stock.lot', 'Lot', domain=[ lot = fields.Many2One('stock.lot', 'Lot', domain=[

View file

@ -99,7 +99,7 @@ product::
>>> line.product = product >>> line.product = product
>>> line.lot = lot1 >>> line.lot = lot1
>>> line.lot.number >>> line.lot.number
u'1' '1'
>>> line.product = product2 >>> line.product = product2
>>> line.lot is None >>> line.lot is None
True True
@ -110,7 +110,7 @@ product that requires lot::
>>> reception.click('done') # doctest: +IGNORE_EXCEPTION_DETAIL >>> reception.click('done') # doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last): Traceback (most recent call last):
... ...
UserError: ('UserError', (u'Lot is required for move of product "Product".', '')) UserError: ('UserError', ('Lot is required for move of product "Product".', ''))
>>> line, = reception.lines >>> line, = reception.lines
>>> line.lot = lot2 >>> line.lot = lot2
>>> reception.click('done') >>> reception.click('done')
@ -118,12 +118,12 @@ product that requires lot::
>>> shipment.party == reception.party >>> shipment.party == reception.party
True True
>>> shipment.state >>> shipment.state
u'done' 'done'
>>> shipment.effective_date == reception.effective_date >>> shipment.effective_date == reception.effective_date
True True
>>> move, = shipment.moves >>> move, = shipment.moves
>>> move.state >>> move.state
u'done' 'done'
>>> move.product == product2 >>> move.product == product2
True True
>>> move.lot == lot2 >>> move.lot == lot2