update to 4.7
This commit is contained in:
parent
8116400bc7
commit
dbbacc0e0e
|
@ -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
|
|
@ -1,10 +1,10 @@
|
|||
# The COPYRIGHT file at the top level of this repository contains the full
|
||||
# copyright notices and license terms.
|
||||
from trytond.pool import Pool
|
||||
from .purchase_request import *
|
||||
from . import purchase_request
|
||||
|
||||
|
||||
def register():
|
||||
Pool.register(
|
||||
PurchaseRequest,
|
||||
purchase_request.PurchaseRequest,
|
||||
module='purchase_request_pending', type_='model')
|
||||
|
|
|
@ -32,5 +32,17 @@
|
|||
ref="purchase_request.act_purchase_request_form"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.model.button"
|
||||
id="purchase_request_draft_button">
|
||||
<field name="name">draft</field>
|
||||
<field name="string">Draft</field>
|
||||
<field name="model" search="[('model', '=', 'purchase.request')]"/>
|
||||
</record>
|
||||
<record model="ir.model.button"
|
||||
id="purchase_request_pending_button">
|
||||
<field name="name">to_pending</field>
|
||||
<field name="string">Pending</field>
|
||||
<field name="model" search="[('model', '=', 'purchase.request')]"/>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
||||
|
|
45
setup.py
45
setup.py
|
@ -4,7 +4,11 @@
|
|||
from setuptools import setup
|
||||
import re
|
||||
import os
|
||||
import ConfigParser
|
||||
import io
|
||||
try:
|
||||
from configparser import ConfigParser
|
||||
except ImportError:
|
||||
from ConfigParser import ConfigParser
|
||||
|
||||
MODULE = 'purchase_request_pending'
|
||||
PREFIX = 'nantic'
|
||||
|
@ -12,7 +16,9 @@ MODULE2PREFIX = {}
|
|||
|
||||
|
||||
def read(fname):
|
||||
return open(os.path.join(os.path.dirname(__file__), fname)).read()
|
||||
return io.open(
|
||||
os.path.join(os.path.dirname(__file__), fname),
|
||||
'r', encoding='utf-8').read()
|
||||
|
||||
|
||||
def get_require_version(name):
|
||||
|
@ -24,7 +30,7 @@ def get_require_version(name):
|
|||
major_version, minor_version + 1)
|
||||
return require
|
||||
|
||||
config = ConfigParser.ConfigParser()
|
||||
config = ConfigParser()
|
||||
config.readfp(open('tryton.cfg'))
|
||||
info = dict(config.items('tryton'))
|
||||
for key in ('depends', 'extras_depend', 'xml'):
|
||||
|
@ -38,14 +44,26 @@ minor_version = int(minor_version)
|
|||
|
||||
requires = []
|
||||
for dep in info.get('depends', []):
|
||||
if not re.match(r'(ir|res|webdav)(\W|$)', dep):
|
||||
if not re.match(r'(ir|res)(\W|$)', dep):
|
||||
prefix = MODULE2PREFIX.get(dep, 'trytond')
|
||||
requires.append('%s_%s >= %s.%s, < %s.%s' %
|
||||
(prefix, dep, major_version, minor_version,
|
||||
major_version, minor_version + 1))
|
||||
requires.append(get_require_version('%s_%s' % (prefix, dep)))
|
||||
requires.append(get_require_version('trytond'))
|
||||
|
||||
tests_require = [get_require_version('proteus')]
|
||||
tests_require = [
|
||||
get_require_version('proteus'),
|
||||
]
|
||||
|
||||
series = '%s.%s' % (major_version, minor_version)
|
||||
if minor_version % 2:
|
||||
branch = 'default'
|
||||
else:
|
||||
branch = series
|
||||
|
||||
dependency_links = []
|
||||
|
||||
if minor_version % 2:
|
||||
# Add development index for testing with proteus
|
||||
dependency_links.append('https://trydevpi.tryton.org/')
|
||||
|
||||
setup(name='%s_%s' % (PREFIX, MODULE),
|
||||
version=version,
|
||||
|
@ -82,12 +100,17 @@ setup(name='%s_%s' % (PREFIX, MODULE),
|
|||
'Natural Language :: Russian',
|
||||
'Natural Language :: Spanish',
|
||||
'Operating System :: OS Independent',
|
||||
'Programming Language :: Python :: 2.6',
|
||||
'Programming Language :: Python :: 2.7',
|
||||
'Programming Language :: Python :: 3.4',
|
||||
'Programming Language :: Python :: 3.5',
|
||||
'Programming Language :: Python :: 3.6',
|
||||
'Programming Language :: Python :: Implementation :: CPython',
|
||||
'Programming Language :: Python :: Implementation :: PyPy',
|
||||
'Topic :: Office/Business',
|
||||
],
|
||||
license='GPL-3',
|
||||
install_requires=requires,
|
||||
dependency_links=dependency_links,
|
||||
zip_safe=False,
|
||||
entry_points="""
|
||||
[trytond.modules]
|
||||
|
@ -96,4 +119,8 @@ setup(name='%s_%s' % (PREFIX, MODULE),
|
|||
test_suite='tests',
|
||||
test_loader='trytond.test_loader:Loader',
|
||||
tests_require=tests_require,
|
||||
use_2to3=True,
|
||||
convert_2to3_doctests=[
|
||||
'tests/scenario_purchase_request_pending.rst',
|
||||
],
|
||||
)
|
||||
|
|
|
@ -11,22 +11,15 @@ Imports::
|
|||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
... create_chart, get_accounts, create_tax, set_tax_code
|
||||
... create_chart, get_accounts, create_tax
|
||||
>>> from trytond.modules.account_invoice.tests.tools import \
|
||||
... set_fiscalyear_invoice_sequences, create_payment_term
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> today = datetime.date.today()
|
||||
|
||||
Create database::
|
||||
Install purchase_request_pending Module::
|
||||
|
||||
>>> config = config.set_trytond()
|
||||
>>> config.pool.test = True
|
||||
|
||||
Install stock Module::
|
||||
|
||||
>>> Module = Model.get('ir.module')
|
||||
>>> module, = Module.find([('name', '=', 'purchase_request_pending')])
|
||||
>>> module.click('install')
|
||||
>>> Wizard('ir.module.install_upgrade').execute('upgrade')
|
||||
>>> config = activate_modules('purchase_request_pending')
|
||||
|
||||
Create company::
|
||||
|
||||
|
@ -108,8 +101,8 @@ There is no purchase request::
|
|||
|
||||
Create the purchase request::
|
||||
|
||||
>>> create_pr = Wizard('purchase.request.create')
|
||||
>>> create_pr.execute('create_')
|
||||
>>> create_pr = Wizard('stock.supply')
|
||||
>>> create_pr.execute('create_')
|
||||
|
||||
There is now a draft purchase request::
|
||||
|
||||
|
@ -119,13 +112,13 @@ There is now a draft purchase request::
|
|||
>>> pr.quantity
|
||||
1.0
|
||||
>>> pr.state
|
||||
'draft'
|
||||
u'draft'
|
||||
|
||||
Set the purchase request to pending state::
|
||||
|
||||
>>> pr.click('to_pending')
|
||||
>>> pr.state
|
||||
'pending'
|
||||
u'pending'
|
||||
|
||||
Create more needs of the same product::
|
||||
|
||||
|
@ -149,7 +142,7 @@ Create more needs of the same product::
|
|||
|
||||
Another purhcase requests is created::
|
||||
|
||||
>>> create_pr = Wizard('purchase.request.create')
|
||||
>>> create_pr = Wizard('stock.supply')
|
||||
>>> create_pr.execute('create_')
|
||||
>>> pending_pr, draft_pr = sorted(PurchaseRequest.find([]),
|
||||
... key=lambda a: a.quantity)
|
||||
|
@ -158,19 +151,19 @@ Another purhcase requests is created::
|
|||
>>> pending_pr.quantity
|
||||
1.0
|
||||
>>> pending_pr.state
|
||||
'pending'
|
||||
u'pending'
|
||||
>>> draft_pr.product == product
|
||||
True
|
||||
>>> draft_pr.quantity
|
||||
2.0
|
||||
>>> draft_pr.state
|
||||
'draft'
|
||||
u'draft'
|
||||
|
||||
Set the purchase request back to draft and chech that they are grouped::
|
||||
|
||||
>>> pending_pr.click('draft')
|
||||
>>> pending_pr.state
|
||||
'draft'
|
||||
u'draft'
|
||||
>>> create_pr = Wizard('purchase.request.create')
|
||||
>>> create_pr.execute('create_')
|
||||
>>> draft_pr, = PurchaseRequest.find([])
|
||||
|
@ -179,4 +172,4 @@ Set the purchase request back to draft and chech that they are grouped::
|
|||
>>> draft_pr.quantity
|
||||
3.0
|
||||
>>> draft_pr.state
|
||||
'draft'
|
||||
u'draft'
|
||||
|
|
|
@ -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 --process-dependency-links {opts} {packages}
|
|
@ -1,5 +1,5 @@
|
|||
[tryton]
|
||||
version=4.1.0
|
||||
version=4.8.0
|
||||
depends:
|
||||
purchase_request
|
||||
stock_supply
|
||||
|
|
Loading…
Reference in New Issue