update to 4.7

This commit is contained in:
?ngel ?lvarez 2018-04-18 16:47:56 +02:00
parent 099a25657a
commit 7db625f24c
5 changed files with 124 additions and 16 deletions

57
.drone.yml Normal file
View File

@ -0,0 +1,57 @@
clone:
hg:
image: plugins/hg
pipeline:
tox:
image: ${IMAGE}
environment:
- CFLAGS=-O0
- DB_CACHE=/cache
- TOX_TESTENV_PASSENV=CFLAGS DB_CACHE
- POSTGRESQL_URI=postgresql://postgres@postgresql:5432/
commands:
- pip install tox
- tox -e "${TOXENV}-${DATABASE}"
notify:
image: drillster/drone-email
from: drone@localhost
host: smtp
port: 25
skip_verify: true
when:
status: [ changed, failure ]
services:
postgresql:
image: postgres
when:
matrix:
DATABASE: postgresql
matrix:
include:
- IMAGE: python:2.7
TOXENV: py27
DATABASE: sqlite
- IMAGE: python:2.7
TOXENV: py27
DATABASE: postgresql
- IMAGE: python:3.4
TOXENV: py34
DATABASE: sqlite
- IMAGE: python:3.4
TOXENV: py34
DATABASE: postgresql
- IMAGE: python:3.5
TOXENV: py35
DATABASE: sqlite
- IMAGE: python:3.5
TOXENV: py35
DATABASE: postgresql
- IMAGE: python:3.6
TOXENV: py36
DATABASE: sqlite
- IMAGE: python:3.6
TOXENV: py36
DATABASE: postgresql

View File

@ -1,13 +1,52 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of # This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms. # this repository contains the full copyright notices and license terms.
from trytond.pool import PoolMeta from trytond import backend
from trytond.model import fields from trytond.pool import PoolMeta, Pool
from trytond.model import fields, ModelSQL, ValueMixin
from trytond.tools.multivalue import migrate_property
__all__ = ['Party'] __all__ = ['Party']
incoterm = fields.Many2One('incoterm', 'Incoterm')
incoterm_place = fields.Char('Incoterm Name Place')
class Party: class Party:
__metaclass__ = PoolMeta __metaclass__ = PoolMeta
__name__ = 'party.party' __name__ = 'party.party'
incoterm = fields.Property(fields.Many2One('incoterm', 'Incoterm')) incoterm = fields.MultiValue(incoterm)
incoterm_place = fields.Property(fields.Char('Incoterm Name Place')) incoterm_place = fields.MultiValue(incoterm_place)
@classmethod
def multivalue_model(cls, field):
pool = Pool()
if field in {'incoterm'}:
return pool.get('party.party.incoterm')
return super(Party, cls).multivalue_model(field)
class PartyIncoterm(ModelSQL, ValueMixin):
"Party Payment Term"
__name__ = 'party.party.incoterm'
party = fields.Many2One(
'party.party', "Party", ondelete='CASCADE', select=True)
incoterm = incoterm
incoterm_place = incoterm_place
@classmethod
def __register__(cls, module_name):
TableHandler = backend.get('TableHandler')
exist = TableHandler.table_exist(cls._table)
super(PartyIncoterm, cls).__register__(module_name)
if not exist:
cls._migrate_property([], [], [])
@classmethod
def _migrate_property(cls, field_names, value_names, fields):
field_names.extend(['incoterm', 'incoterm_place'])
value_names.extend(['incoterm', 'incoterm_place'])
migrate_property(
'party.party', field_names, cls, value_names,
parent='party', fields=fields)

View File

@ -36,13 +36,11 @@ info = dict(config.items('tryton'))
for key in ('depends', 'extras_depend', 'xml'): for key in ('depends', 'extras_depend', 'xml'):
if key in info: if key in info:
info[key] = info[key].strip().splitlines() info[key] = info[key].strip().splitlines()
version = info.get('version', '0.0.1') version = info.get('version', '0.0.1')
major_version, minor_version, _ = version.split('.', 2) major_version, minor_version, _ = version.split('.', 2)
major_version = int(major_version) major_version = int(major_version)
minor_version = int(minor_version) minor_version = int(minor_version)
name = '%s_%s' % (PREFIX, MODULE)
download_url="https://bitbucket.org/nantic/trytond-%s" % MODULE,
requires = [] requires = []
for dep in info.get('depends', []): for dep in info.get('depends', []):
@ -57,14 +55,14 @@ if minor_version % 2:
# Add development index for testing with proteus # Add development index for testing with proteus
dependency_links.append('https://trydevpi.tryton.org/') dependency_links.append('https://trydevpi.tryton.org/')
setup(name=name, setup(name='%s_%s' % (PREFIX, MODULE),
version=version, version=version,
description='', description='',
long_description=read('README'), long_description=read('README'),
author='NaN·tic', author='NaN·tic',
author_email='info@nan-tic.com', author_email='info@nan-tic.com',
url='http://www.nan-tic.com/', url='http://www.nan-tic.com/',
download_url=download_url, download_url="https://bitbucket.org/nantic/trytond-%s" % MODULE,
package_dir={'trytond.modules.%s' % MODULE: '.'}, package_dir={'trytond.modules.%s' % MODULE: '.'},
packages=[ packages=[
'trytond.modules.%s' % MODULE, 'trytond.modules.%s' % MODULE,
@ -72,7 +70,7 @@ setup(name=name,
], ],
package_data={ package_data={
'trytond.modules.%s' % MODULE: (info.get('xml', []) 'trytond.modules.%s' % MODULE: (info.get('xml', [])
+ ['tryton.cfg', 'locale/*.po', 'tests/*.rst', 'view/*.xml']), + ['tryton.cfg', 'view/*.xml', 'locale/*.po', 'tests/*.rst']),
}, },
classifiers=[ classifiers=[
'Development Status :: 5 - Production/Stable', 'Development Status :: 5 - Production/Stable',
@ -89,23 +87,20 @@ setup(name=name,
'Natural Language :: English', 'Natural Language :: English',
'Natural Language :: French', 'Natural Language :: French',
'Natural Language :: German', 'Natural Language :: German',
'Natural Language :: Hungarian',
'Natural Language :: Italian',
'Natural Language :: Portuguese (Brazilian)',
'Natural Language :: Russian', 'Natural Language :: Russian',
'Natural Language :: Slovenian',
'Natural Language :: Spanish', 'Natural Language :: Spanish',
'Operating System :: OS Independent', 'Operating System :: OS Independent',
'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy', 'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Office/Business', 'Topic :: Office/Business',
], ],
license='GPL-3', license='GPL-3',
install_requires=requires, install_requires=requires,
dependency_links=dependency_links,
zip_safe=False, zip_safe=False,
entry_points=""" entry_points="""
[trytond.modules] [trytond.modules]
@ -115,4 +110,6 @@ setup(name=name,
test_loader='trytond.test_loader:Loader', test_loader='trytond.test_loader:Loader',
tests_require=tests_require, tests_require=tests_require,
use_2to3=True, use_2to3=True,
convert_2to3_doctests=[
]
) )

15
tox.ini Normal file
View File

@ -0,0 +1,15 @@
[tox]
envlist = {py27,py34,py35,py36}-{sqlite,postgresql},pypy-{sqlite,postgresql}
[testenv]
commands = {envpython} setup.py test
deps =
{py27,py34,py35,py36}-postgresql: psycopg2 >= 2.5
pypy-postgresql: psycopg2cffi >= 2.5
sqlite: sqlitebck
setenv =
sqlite: TRYTOND_DATABASE_URI={env:SQLITE_URI:sqlite://}
postgresql: TRYTOND_DATABASE_URI={env:POSTGRESQL_URI:postgresql://}
sqlite: DB_NAME={env:SQLITE_NAME::memory:}
postgresql: DB_NAME={env:POSTGRESQL_NAME:test}
install_command = pip install --pre --find-links https://trydevpi.tryton.org/ {opts} {packages}

View File

@ -1,5 +1,5 @@
[tryton] [tryton]
version=4.3.0 version=4.7.0
depends: depends:
ir ir
party party