Remove support for Python 2.7
issue7497 review53261002
This commit is contained in:
@@ -25,12 +25,6 @@ services:
|
||||
|
||||
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
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
* Remove support for Python 2.7
|
||||
|
||||
Version 4.8.0 - 2018-04-23
|
||||
* Bug fixes (see mercurial logs for details)
|
||||
* Make description on purchase request optional
|
||||
|
||||
@@ -4,7 +4,7 @@ Installing trytond_purchase_request
|
||||
Prerequisites
|
||||
-------------
|
||||
|
||||
* Python 2.7 or later (http://www.python.org/)
|
||||
* Python 3.4 or later (http://www.python.org/)
|
||||
* trytond (http://www.tryton.org/)
|
||||
|
||||
Installation
|
||||
|
||||
@@ -5,8 +5,7 @@ from trytond.pool import PoolMeta
|
||||
__all__ = ['PartyReplace']
|
||||
|
||||
|
||||
class PartyReplace:
|
||||
__metaclass__ = PoolMeta
|
||||
class PartyReplace(metaclass=PoolMeta):
|
||||
__name__ = 'party.replace'
|
||||
|
||||
@classmethod
|
||||
|
||||
+2
-4
@@ -21,9 +21,8 @@ def process_request(func):
|
||||
return wrapper
|
||||
|
||||
|
||||
class Purchase:
|
||||
class Purchase(metaclass=PoolMeta):
|
||||
__name__ = 'purchase.purchase'
|
||||
__metaclass__ = PoolMeta
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
@@ -89,8 +88,7 @@ class Purchase:
|
||||
super(Purchase, cls).do(purchases)
|
||||
|
||||
|
||||
class PurchaseLine:
|
||||
__metaclass__ = PoolMeta
|
||||
class PurchaseLine(metaclass=PoolMeta):
|
||||
__name__ = 'purchase.line'
|
||||
|
||||
requests = fields.One2Many(
|
||||
|
||||
+3
-3
@@ -2,7 +2,7 @@
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
import datetime
|
||||
from decimal import Decimal
|
||||
from itertools import groupby, ifilter
|
||||
from itertools import groupby
|
||||
from functools import partial
|
||||
|
||||
from trytond import backend
|
||||
@@ -384,7 +384,7 @@ class CreatePurchase(Wizard):
|
||||
and request.product == self.ask_party.product
|
||||
and compare_string(
|
||||
request.description, self.ask_party.description))
|
||||
reqs = filter(to_write, requests)
|
||||
reqs = list(filter(to_write, requests))
|
||||
if reqs:
|
||||
Request.write(reqs, {
|
||||
'party': self.ask_party.party.id,
|
||||
@@ -396,7 +396,7 @@ class CreatePurchase(Wizard):
|
||||
|
||||
def to_ask_party(request):
|
||||
return not request.purchase_line and not request.party
|
||||
reqs = ifilter(to_ask_party, requests)
|
||||
reqs = filter(to_ask_party, requests)
|
||||
if any(reqs):
|
||||
return 'ask_party'
|
||||
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from setuptools import setup
|
||||
import re
|
||||
import os
|
||||
import io
|
||||
try:
|
||||
from configparser import ConfigParser
|
||||
except ImportError:
|
||||
from ConfigParser import ConfigParser
|
||||
import os
|
||||
import re
|
||||
from configparser import ConfigParser
|
||||
from setuptools import setup
|
||||
|
||||
|
||||
def read(fname):
|
||||
@@ -27,6 +24,7 @@ def get_require_version(name):
|
||||
major_version, minor_version + 1)
|
||||
return require
|
||||
|
||||
|
||||
config = ConfigParser()
|
||||
config.readfp(open('tryton.cfg'))
|
||||
info = dict(config.items('tryton'))
|
||||
@@ -103,7 +101,6 @@ setup(name=name,
|
||||
'Natural Language :: Slovenian',
|
||||
'Natural Language :: Spanish',
|
||||
'Operating System :: OS Independent',
|
||||
'Programming Language :: Python :: 2.7',
|
||||
'Programming Language :: Python :: 3.4',
|
||||
'Programming Language :: Python :: 3.5',
|
||||
'Programming Language :: Python :: 3.6',
|
||||
@@ -112,6 +109,7 @@ setup(name=name,
|
||||
'Topic :: Office/Business',
|
||||
],
|
||||
license='GPL-3',
|
||||
python_requires='>=3.4',
|
||||
install_requires=requires,
|
||||
dependency_links=dependency_links,
|
||||
zip_safe=False,
|
||||
@@ -121,9 +119,5 @@ setup(name=name,
|
||||
""",
|
||||
test_suite='tests',
|
||||
test_loader='trytond.test_loader:Loader',
|
||||
use_2to3=True,
|
||||
convert_2to3_doctests=[
|
||||
'tests/scenario_purchase_request.rst',
|
||||
],
|
||||
tests_require=tests_require,
|
||||
)
|
||||
|
||||
@@ -169,14 +169,14 @@ Create the purchase then cancel it::
|
||||
>>> create_purchase.form.party = supplier
|
||||
>>> create_purchase.execute('start')
|
||||
>>> pr.state
|
||||
u'purchased'
|
||||
'purchased'
|
||||
|
||||
>>> Purchase = Model.get('purchase.purchase')
|
||||
>>> purchase, = Purchase.find()
|
||||
>>> purchase.click('cancel')
|
||||
>>> pr.reload()
|
||||
>>> pr.state
|
||||
u'exception'
|
||||
'exception'
|
||||
|
||||
Handle the exception::
|
||||
|
||||
@@ -184,20 +184,20 @@ Handle the exception::
|
||||
... 'purchase.request.handle.purchase.cancellation', [pr])
|
||||
>>> handle_exception.execute('reset')
|
||||
>>> pr.state
|
||||
u'draft'
|
||||
'draft'
|
||||
|
||||
Recreate a purchase and cancel it again::
|
||||
|
||||
>>> create_purchase = Wizard('purchase.request.create_purchase',
|
||||
... [pr])
|
||||
>>> pr.state
|
||||
u'purchased'
|
||||
'purchased'
|
||||
|
||||
>>> purchase, = Purchase.find([('state', '=', 'draft')])
|
||||
>>> purchase.click('cancel')
|
||||
>>> pr.reload()
|
||||
>>> pr.state
|
||||
u'exception'
|
||||
'exception'
|
||||
|
||||
Handle again the exception::
|
||||
|
||||
@@ -205,7 +205,7 @@ Handle again the exception::
|
||||
... 'purchase.request.handle.purchase.cancellation', [pr])
|
||||
>>> handle_exception.execute('cancel_request')
|
||||
>>> pr.state
|
||||
u'cancel'
|
||||
'cancel'
|
||||
|
||||
Re-create the purchase request::
|
||||
|
||||
@@ -236,7 +236,7 @@ Create the purchase with a unique line::
|
||||
>>> create_purchase.form.party = supplier
|
||||
>>> create_purchase.execute('start')
|
||||
>>> pr.state
|
||||
u'purchased'
|
||||
'purchased'
|
||||
|
||||
>>> Purchase = Model.get('purchase.purchase')
|
||||
>>> purchase, = Purchase.find([('state', '=', 'draft')])
|
||||
@@ -265,11 +265,11 @@ Create the purchase without product::
|
||||
>>> create_purchase.form.party = supplier
|
||||
>>> create_purchase.execute('start')
|
||||
>>> pr.state
|
||||
u'purchased'
|
||||
'purchased'
|
||||
|
||||
>>> pr.purchase_line.product
|
||||
>>> pr.purchase_line.description
|
||||
u'Custom product'
|
||||
'Custom product'
|
||||
>>> pr.purchase_line.quantity
|
||||
1.0
|
||||
>>> pr.purchase_line.unit
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
[tox]
|
||||
envlist = {py27,py34,py35,py36}-{sqlite,postgresql},pypy-{sqlite,postgresql}
|
||||
envlist = {py34,py35,py36}-{sqlite,postgresql},pypy3-{sqlite,postgresql}
|
||||
|
||||
[testenv]
|
||||
commands = {envpython} setup.py test
|
||||
deps =
|
||||
{py27,py34,py35,py36}-postgresql: psycopg2 >= 2.5
|
||||
pypy-postgresql: psycopg2cffi >= 2.5
|
||||
{py34,py35,py36}-postgresql: psycopg2 >= 2.5
|
||||
pypy3-postgresql: psycopg2cffi >= 2.5
|
||||
sqlite: sqlitebck
|
||||
setenv =
|
||||
sqlite: TRYTOND_DATABASE_URI={env:SQLITE_URI:sqlite://}
|
||||
|
||||
Reference in New Issue
Block a user