From 3e068944546f710ff12a6c037121da67cac3eb7c Mon Sep 17 00:00:00 2001 From: Sergio Morillo Date: Thu, 31 Jan 2019 09:46:43 +0100 Subject: [PATCH] Load party when changing type in sale cost. This commit refs #7137 --- .drone.yml | 12 ------------ sale_cost.py | 5 +++++ setup.py | 36 ++++++++++++++++++++++-------------- tox.ini | 6 +++--- 4 files changed, 30 insertions(+), 29 deletions(-) diff --git a/.drone.yml b/.drone.yml index b873d8e..67aa49b 100644 --- a/.drone.yml +++ b/.drone.yml @@ -38,18 +38,6 @@ matrix: - 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 diff --git a/sale_cost.py b/sale_cost.py index 3428491..988d487 100644 --- a/sale_cost.py +++ b/sale_cost.py @@ -38,3 +38,8 @@ class SaleCost(ApplyMethodCostDocumentMixin): super(SaleCost, self).on_change_template() if self.template: self.invoice_party = self.template.invoice_party + + def on_change_type_(self): + super(SaleCost, self).on_change_type_() + if self.type_: + self.invoice_party = self.type_.invoice_party diff --git a/setup.py b/setup.py index 25c42e4..551e605 100644 --- a/setup.py +++ b/setup.py @@ -46,33 +46,41 @@ minor_version = int(minor_version) name = 'datalife_sale_cost_apply_invoice' download_url = 'https://bitbucket.org/datalife_sco/trytond-sale_cost_apply_invoice' -requires = [] -for dep in info.get('depends', []): - if not re.match(r'(ir|res)(\W|$)', dep): - prefix = MODULE2PREFIX.get(dep, 'trytond') - requires.append(get_require_version('%s_%s' % (prefix, dep))) -requires.append(get_require_version('trytond')) - -tests_require = [get_require_version('proteus')] series = '%s.%s' % (major_version, minor_version) if minor_version % 2: branch = 'default' else: branch = series -dependency_links = [ - ('hg+https://bitbucket.org/datalife_sco/' +dependency_links = { + 'sale_cost': + 'hg+https://bitbucket.org/datalife_sco/' 'trytond-sale_cost@%(branch)s' '#egg=datalife_sale_cost-%(series)s' % { 'branch': branch, 'series': series, - }), - ('hg+https://bitbucket.org/datalife_sco/' + }, + 'document_cost_apply_invoice': + 'hg+https://bitbucket.org/datalife_sco/' 'trytond-document_cost_apply_invoice@%(branch)s' '#egg=datalife_document_cost_apply_invoice-%(series)s' % { 'branch': branch, 'series': series, - }), -] + }, +} + +requires = [] +for dep in info.get('depends', []): + if not re.match(r'(ir|res)(\W|$)', dep): + prefix = MODULE2PREFIX.get(dep, 'trytond') + req = get_require_version('%s_%s' % (prefix, dep)) + if dep in dependency_links: + req = '%s_%s @ %s' % (prefix, dep, dependency_links[dep]) + requires.append(req) +requires.append(get_require_version('trytond')) + +tests_require = [get_require_version('proteus')] + +dependency_links = list(dependency_links.values()) if minor_version % 2: dependency_links.append('https://trydevpi.tryton.org/') diff --git a/tox.ini b/tox.ini index 3d844ea..f8a2206 100644 --- a/tox.ini +++ b/tox.ini @@ -1,10 +1,10 @@ [tox] -envlist = {py27,py34,py35,py36}-{sqlite,postgresql,mysql},pypy-{sqlite,postgresql} +envlist = {py27,py36}-{sqlite,postgresql,mysql},pypy-{sqlite,postgresql} [testenv] commands = {envpython} setup.py test deps = - {py27,py34,py35,py36}-postgresql: psycopg2 >= 2.5 + {py27,py36}-postgresql: psycopg2 >= 2.5 pypy-postgresql: psycopg2cffi >= 2.5 mysql: MySQL-python sqlite: sqlitebck @@ -15,4 +15,4 @@ setenv = sqlite: DB_NAME={env:SQLITE_NAME::memory:} postgresql: DB_NAME={env:POSTGRESQL_NAME:test} mysql: DB_NAME={env:MYSQL_NAME:test} -install_command = pip install --pre --process-dependency-links {opts} {packages} +install_command = pip install --pre {opts} {packages}