Remove support for Python 2.7

issue7497
review53261002
This commit is contained in:
Cédric Krier committed 2018-06-26 19:11:52 +02:00
1 parent 2c1b26421e
commit 376c5100af
9 files changed
+34 -48

No files matched your search

-6
View File
@@ -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
+3 -1
View File
@@ -1,3 +1,5 @@
* Remove support for Python 2.7
Version 4.8.0 - 2018-04-23
* Bug fixes (see mercurial logs for details)
@@ -5,4 +7,4 @@ Version 4.6.0 - 2017-10-30
* Bug fixes (see mercurial logs for details)
Version 4.4.0 - 2017-05-01
* Initial release
* Initial release
+1 -1
View File
@@ -4,7 +4,7 @@ Installing trytond_sale_advance_payment
Prerequisites
-------------
* Python 2.7 or later (http://www.python.org/)
* Python 3.4 or later (http://www.python.org/)
* simpleeval (https://github.com/danthedeckie/simpleeval)
* trytond (http://www.tryton.org/)
* trytond_sale (http://www.tryton.org/)
+2 -4
View File
@@ -6,9 +6,8 @@ from trytond.pool import Pool, PoolMeta
__all__ = ['Invoice', 'InvoiceLine']
class Invoice:
class Invoice(metaclass=PoolMeta):
__name__ = 'account.invoice'
__metaclass__ = PoolMeta
def get_sales(self, name):
pool = Pool()
@@ -21,9 +20,8 @@ class Invoice:
return list(sales)
class InvoiceLine:
class InvoiceLine(metaclass=PoolMeta):
__name__ = 'account.invoice.line'
__metaclass__ = PoolMeta
@classmethod
def _get_origin(cls):
+4 -7
View File
@@ -95,7 +95,7 @@ class AdvancePaymentTermLine(ModelView, ModelSQL, CompanyMultiValueMixin):
try:
if not isinstance(self.compute_amount(**names), Decimal):
raise Exception('The formula does not return a Decimal')
except Exception, exception:
except Exception as exception:
self.raise_user_error('invalid_formula', {
'formula': self.formula,
'exception': exception,
@@ -280,9 +280,8 @@ class AdvancePaymentCondition(ModelSQL, ModelView):
return advance_amount >= self.amount
class Sale:
class Sale(metaclass=PoolMeta):
__name__ = 'sale.sale'
__metaclass__ = PoolMeta
advance_payment_term = fields.Many2One('sale.advance_payment_term',
'Advance Payment Term',
@@ -451,9 +450,8 @@ class Sale:
return False
class SaleLine:
class SaleLine(metaclass=PoolMeta):
__name__ = 'sale.line'
__metaclass__ = PoolMeta
def get_move(self, shipment_type):
move = super(SaleLine, self).get_move(shipment_type)
@@ -477,8 +475,7 @@ class SaleLine:
return lines
class HandleInvoiceException:
__metaclass__ = PoolMeta
class HandleInvoiceException(metaclass=PoolMeta):
__name__ = 'sale.handle.invoice.exception'
def default_ask(self, fields):
+7 -11
View File
@@ -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'))
@@ -104,7 +102,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',
@@ -114,6 +111,7 @@ setup(name=name,
'Topic :: Office/Business :: Financial :: Accounting',
],
license='GPL-3',
python_requires='>=3.4',
install_requires=requires,
dependency_links=dependency_links,
zip_safe=False,
@@ -124,6 +122,4 @@ setup(name=name,
test_suite='tests',
test_loader='trytond.test_loader:Loader',
tests_require=tests_require,
use_2to3=True,
convert_2to3_doctests=['tests/scenario_advance_payment.rst'],
)
+1 -2
View File
@@ -7,9 +7,8 @@ from trytond.pool import Pool, PoolMeta
__all__ = ['ShipmentOut']
class ShipmentOut:
class ShipmentOut(metaclass=PoolMeta):
__name__ = 'stock.shipment.out'
__metaclass__ = PoolMeta
@classmethod
def __setup__(cls):
+13 -13
View File
@@ -108,7 +108,7 @@ Create an inventory::
>>> inventory_line.expected_quantity = 0.0
>>> inventory.click('confirm')
>>> inventory.state
u'done'
'done'
Create advance payment term preventing the creation of shipment::
@@ -131,7 +131,7 @@ Create a normal sale::
>>> sale.click('confirm')
>>> sale.click('process')
>>> sale.state
u'processing'
'processing'
As usual an invoice and a shipment has been created::
@@ -160,7 +160,7 @@ Create a sale with advance payment::
>>> sale.click('confirm')
>>> sale.click('process')
>>> sale.state
u'processing'
'processing'
The advance payment invoice has been created::
@@ -186,7 +186,7 @@ Let's pay the advance payment invoice::
>>> sale.reload()
>>> sale.state
u'processing'
'processing'
>>> len(sale.invoices)
1
>>> len(sale.shipments)
@@ -233,7 +233,7 @@ Create a sale with advance payment::
>>> sale.click('confirm')
>>> sale.click('process')
>>> sale.state
u'processing'
'processing'
The shipment has been created::
@@ -258,14 +258,14 @@ Let's pay the advance payment invoice::
>>> pay.execute('choice')
>>> sale.reload()
>>> sale.state
u'processing'
'processing'
Packing the shipment is now allowed::
>>> shipment.click('pack')
>>> shipment.reload()
>>> shipment.state
u'packed'
'packed'
In case the product is to be supplied on sale
---------------------------------------------
@@ -298,7 +298,7 @@ Sell 10 of those products::
>>> sale.click('confirm')
>>> sale.click('process')
>>> sale.state
u'processing'
'processing'
There is no purchase request created yet::
@@ -315,7 +315,7 @@ The advance payment invoice has been created, now pay it::
>>> pay.execute('choice')
>>> sale.reload()
>>> sale.state
u'processing'
'processing'
There is now a purchase request of the desired quantity::
@@ -342,7 +342,7 @@ Create a sale with this term::
>>> sale.click('confirm')
>>> sale.click('process')
>>> sale.state
u'processing'
'processing'
Let's cancel the advance invoice::
@@ -350,7 +350,7 @@ Let's cancel the advance invoice::
>>> inv.click('cancel')
>>> sale.reload()
>>> sale.invoice_state
u'exception'
'exception'
Handle the exception on the sale level, not recreating the invoice will create
the final invoice with the remaining total::
@@ -381,12 +381,12 @@ it::
>>> sale.click('confirm')
>>> sale.click('process')
>>> sale.state
u'processing'
'processing'
>>> inv, = sale.advance_payment_invoices
>>> inv.click('cancel')
>>> sale.reload()
>>> sale.invoice_state
u'exception'
'exception'
>>> handle_exception = Wizard('sale.handle.invoice.exception', [sale])
>>> handle_exception.execute('handle')
+3 -3
View File
@@ -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://}