update to 4.7
This commit is contained in:
parent
79974ce3e7
commit
30c47486c7
|
@ -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
|
7
bom.xml
7
bom.xml
|
@ -27,6 +27,13 @@
|
||||||
<field name="view" ref="bom_drawing_line_view_form"/>
|
<field name="view" ref="bom_drawing_line_view_form"/>
|
||||||
<field name="act_window" ref="act_production_bom_drawing_line"/>
|
<field name="act_window" ref="act_production_bom_drawing_line"/>
|
||||||
</record>
|
</record>
|
||||||
|
<record model="ir.model.access" id="access_production_bom_drawing_line_base">
|
||||||
|
<field name="model" search="[('model', '=', 'production.bom.drawing.line')]"/>
|
||||||
|
<field name="perm_read" eval="True"/>
|
||||||
|
<field name="perm_write" eval="False"/>
|
||||||
|
<field name="perm_create" eval="False"/>
|
||||||
|
<field name="perm_delete" eval="False"/>
|
||||||
|
</record>
|
||||||
<record model="ir.model.access" id="access_production_bom_drawing_line">
|
<record model="ir.model.access" id="access_production_bom_drawing_line">
|
||||||
<field name="model" search="[('model', '=', 'production.bom.drawing.line')]"/>
|
<field name="model" search="[('model', '=', 'production.bom.drawing.line')]"/>
|
||||||
<field name="group" ref="production.group_production"/>
|
<field name="group" ref="production.group_production"/>
|
||||||
|
|
17
drawing.xml
17
drawing.xml
|
@ -35,6 +35,14 @@
|
||||||
<field name="perm_create" eval="False"/>
|
<field name="perm_create" eval="False"/>
|
||||||
<field name="perm_delete" eval="False"/>
|
<field name="perm_delete" eval="False"/>
|
||||||
</record>
|
</record>
|
||||||
|
<record model="ir.model.access" id="access_production_drawing_base">
|
||||||
|
<field name="model" search="[('model', '=', 'production.drawing')]"/>
|
||||||
|
<field name="perm_read" eval="True"/>
|
||||||
|
<field name="perm_write" eval="True"/>
|
||||||
|
<field name="perm_create" eval="True"/>
|
||||||
|
<field name="perm_delete" eval="True"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
<record model="ir.model.access" id="access_production_drawing_admin">
|
<record model="ir.model.access" id="access_production_drawing_admin">
|
||||||
<field name="model" search="[('model', '=', 'production.drawing')]"/>
|
<field name="model" search="[('model', '=', 'production.drawing')]"/>
|
||||||
<field name="group" ref="production.group_production_admin"/>
|
<field name="group" ref="production.group_production_admin"/>
|
||||||
|
@ -67,6 +75,13 @@
|
||||||
<field name="view" ref="drawing_position_view_form"/>
|
<field name="view" ref="drawing_position_view_form"/>
|
||||||
<field name="act_window" ref="act_production_drawing_position"/>
|
<field name="act_window" ref="act_production_drawing_position"/>
|
||||||
</record>
|
</record>
|
||||||
|
<record model="ir.model.access" id="access_production_drawing_position_base">
|
||||||
|
<field name="model" search="[('model', '=', 'production.drawing.position')]"/>
|
||||||
|
<field name="perm_read" eval="True"/>
|
||||||
|
<field name="perm_write" eval="False"/>
|
||||||
|
<field name="perm_create" eval="False"/>
|
||||||
|
<field name="perm_delete" eval="False"/>
|
||||||
|
</record>
|
||||||
<record model="ir.model.access" id="access_production_drawing_position">
|
<record model="ir.model.access" id="access_production_drawing_position">
|
||||||
<field name="model" search="[('model', '=', 'production.drawing.position')]"/>
|
<field name="model" search="[('model', '=', 'production.drawing.position')]"/>
|
||||||
<field name="group" ref="production.group_production"/>
|
<field name="group" ref="production.group_production"/>
|
||||||
|
@ -83,6 +98,8 @@
|
||||||
<field name="perm_create" eval="True"/>
|
<field name="perm_create" eval="True"/>
|
||||||
<field name="perm_delete" eval="True"/>
|
<field name="perm_delete" eval="True"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|
||||||
<!-- Menus -->
|
<!-- Menus -->
|
||||||
<menuitem action="act_production_drawing" id="menu_production_drawing"
|
<menuitem action="act_production_drawing" id="menu_production_drawing"
|
||||||
parent="production.menu_configuration" sequence="1"
|
parent="production.menu_configuration" sequence="1"
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Production:
|
||||||
@fields.depends('drawing')
|
@fields.depends('drawing')
|
||||||
def on_change_with_drawing_lines(self):
|
def on_change_with_drawing_lines(self):
|
||||||
if not self.bom or not self.bom.drawing:
|
if not self.bom or not self.bom.drawing:
|
||||||
to_remove = [x.id for x in self.drawing_lines]
|
to_remove = [x.id for x in getattr(self, 'drawing_lines')]
|
||||||
return {
|
return {
|
||||||
'remove': to_remove,
|
'remove': to_remove,
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,13 @@
|
||||||
<field name="view" ref="production_drawing_line_view_form"/>
|
<field name="view" ref="production_drawing_line_view_form"/>
|
||||||
<field name="act_window" ref="act_production_drawing_line"/>
|
<field name="act_window" ref="act_production_drawing_line"/>
|
||||||
</record>
|
</record>
|
||||||
|
<record model="ir.model.access" id="access_production_drawing_line_base">
|
||||||
|
<field name="model" search="[('model', '=', 'production.drawing.line')]"/>
|
||||||
|
<field name="perm_read" eval="True"/>
|
||||||
|
<field name="perm_write" eval="False"/>
|
||||||
|
<field name="perm_create" eval="False"/>
|
||||||
|
<field name="perm_delete" eval="False"/>
|
||||||
|
</record>
|
||||||
<record model="ir.model.access" id="access_production_drawing_line">
|
<record model="ir.model.access" id="access_production_drawing_line">
|
||||||
<field name="model" search="[('model', '=', 'production.drawing.line')]"/>
|
<field name="model" search="[('model', '=', 'production.drawing.line')]"/>
|
||||||
<field name="group" ref="production.group_production"/>
|
<field name="group" ref="production.group_production"/>
|
||||||
|
|
45
setup.py
45
setup.py
|
@ -4,7 +4,11 @@
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
import ConfigParser
|
import io
|
||||||
|
try:
|
||||||
|
from configparser import ConfigParser
|
||||||
|
except ImportError:
|
||||||
|
from ConfigParser import ConfigParser
|
||||||
|
|
||||||
MODULE = 'production_drawing'
|
MODULE = 'production_drawing'
|
||||||
PREFIX = 'nantic'
|
PREFIX = 'nantic'
|
||||||
|
@ -12,7 +16,9 @@ MODULE2PREFIX = {}
|
||||||
|
|
||||||
|
|
||||||
def read(fname):
|
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):
|
def get_require_version(name):
|
||||||
|
@ -24,7 +30,7 @@ def get_require_version(name):
|
||||||
major_version, minor_version + 1)
|
major_version, minor_version + 1)
|
||||||
return require
|
return require
|
||||||
|
|
||||||
config = ConfigParser.ConfigParser()
|
config = ConfigParser()
|
||||||
config.readfp(open('tryton.cfg'))
|
config.readfp(open('tryton.cfg'))
|
||||||
info = dict(config.items('tryton'))
|
info = dict(config.items('tryton'))
|
||||||
for key in ('depends', 'extras_depend', 'xml'):
|
for key in ('depends', 'extras_depend', 'xml'):
|
||||||
|
@ -38,14 +44,26 @@ minor_version = int(minor_version)
|
||||||
|
|
||||||
requires = []
|
requires = []
|
||||||
for dep in info.get('depends', []):
|
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')
|
prefix = MODULE2PREFIX.get(dep, 'trytond')
|
||||||
requires.append('%s_%s >= %s.%s, < %s.%s' %
|
requires.append(get_require_version('%s_%s' % (prefix, dep)))
|
||||||
(prefix, dep, major_version, minor_version,
|
|
||||||
major_version, minor_version + 1))
|
|
||||||
requires.append(get_require_version('trytond'))
|
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),
|
setup(name='%s_%s' % (PREFIX, MODULE),
|
||||||
version=version,
|
version=version,
|
||||||
|
@ -82,12 +100,17 @@ setup(name='%s_%s' % (PREFIX, MODULE),
|
||||||
'Natural Language :: Russian',
|
'Natural Language :: Russian',
|
||||||
'Natural Language :: Spanish',
|
'Natural Language :: Spanish',
|
||||||
'Operating System :: OS Independent',
|
'Operating System :: OS Independent',
|
||||||
'Programming Language :: Python :: 2.6',
|
|
||||||
'Programming Language :: Python :: 2.7',
|
'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',
|
'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]
|
||||||
|
@ -96,4 +119,8 @@ setup(name='%s_%s' % (PREFIX, MODULE),
|
||||||
test_suite='tests',
|
test_suite='tests',
|
||||||
test_loader='trytond.test_loader:Loader',
|
test_loader='trytond.test_loader:Loader',
|
||||||
tests_require=tests_require,
|
tests_require=tests_require,
|
||||||
|
use_2to3=True,
|
||||||
|
convert_2to3_doctests=[
|
||||||
|
'tests/scenario_production.rst',
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
|
|
@ -12,46 +12,25 @@ Imports::
|
||||||
>>> from dateutil.relativedelta import relativedelta
|
>>> from dateutil.relativedelta import relativedelta
|
||||||
>>> from decimal import Decimal
|
>>> from decimal import Decimal
|
||||||
>>> from proteus import config, Model, Wizard
|
>>> from proteus import config, Model, Wizard
|
||||||
|
>>> from trytond.tests.tools import activate_modules
|
||||||
>>> today = datetime.date.today()
|
>>> today = datetime.date.today()
|
||||||
>>> yesterday = today - relativedelta(days=1)
|
>>> yesterday = today - relativedelta(days=1)
|
||||||
|
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||||
|
... get_company
|
||||||
|
|
||||||
Create database::
|
Install product_cost_plan Module::
|
||||||
|
|
||||||
>>> config = config.set_trytond()
|
>>> config = activate_modules('production_drawing')
|
||||||
>>> config.pool.test = True
|
|
||||||
|
|
||||||
Install production Module::
|
|
||||||
|
|
||||||
>>> Module = Model.get('ir.module.module')
|
|
||||||
>>> modules = Module.find([('name', '=', 'production_drawing')])
|
|
||||||
>>> Module.install([x.id for x in modules], config.context)
|
|
||||||
>>> Wizard('ir.module.module.install_upgrade').execute('upgrade')
|
|
||||||
|
|
||||||
Create company::
|
Create company::
|
||||||
|
|
||||||
>>> Currency = Model.get('currency.currency')
|
>>> _ = create_company()
|
||||||
>>> CurrencyRate = Model.get('currency.currency.rate')
|
>>> company = get_company()
|
||||||
>>> Company = Model.get('company.company')
|
>>> tax_identifier = company.party.identifiers.new()
|
||||||
>>> Party = Model.get('party.party')
|
>>> tax_identifier.type = 'eu_vat'
|
||||||
>>> company_config = Wizard('company.company.config')
|
>>> tax_identifier.code = 'BE0897290877'
|
||||||
>>> company_config.execute('company')
|
>>> company.party.save()
|
||||||
>>> company = company_config.form
|
|
||||||
>>> party = Party(name='Dunder Mifflin')
|
|
||||||
>>> party.save()
|
|
||||||
>>> company.party = party
|
|
||||||
>>> currencies = Currency.find([('code', '=', 'USD')])
|
|
||||||
>>> if not currencies:
|
|
||||||
... currency = Currency(name='Euro', symbol=u'$', code='USD',
|
|
||||||
... rounding=Decimal('0.01'), mon_grouping='[3, 3, 0]',
|
|
||||||
... mon_decimal_point=',')
|
|
||||||
... currency.save()
|
|
||||||
... CurrencyRate(date=today + relativedelta(month=1, day=1),
|
|
||||||
... rate=Decimal('1.0'), currency=currency).save()
|
|
||||||
... else:
|
|
||||||
... currency, = currencies
|
|
||||||
>>> company.currency = currency
|
|
||||||
>>> company_config.execute('add')
|
|
||||||
>>> company, = Company.find()
|
|
||||||
|
|
||||||
Reload the context::
|
Reload the context::
|
||||||
|
|
||||||
|
@ -67,12 +46,13 @@ Create product::
|
||||||
>>> product = Product()
|
>>> product = Product()
|
||||||
>>> template = ProductTemplate()
|
>>> template = ProductTemplate()
|
||||||
>>> template.name = 'product'
|
>>> template.name = 'product'
|
||||||
|
>>> template.producible = True
|
||||||
>>> template.default_uom = unit
|
>>> template.default_uom = unit
|
||||||
>>> template.type = 'goods'
|
>>> template.type = 'goods'
|
||||||
>>> template.list_price = Decimal(30)
|
>>> template.list_price = Decimal(30)
|
||||||
>>> template.cost_price = Decimal(20)
|
|
||||||
>>> template.save()
|
>>> template.save()
|
||||||
>>> product.template = template
|
>>> product.template = template
|
||||||
|
>>> product.cost_price = Decimal(20)
|
||||||
>>> product.save()
|
>>> product.save()
|
||||||
|
|
||||||
Create Components::
|
Create Components::
|
||||||
|
@ -132,10 +112,7 @@ Create Bill of Material::
|
||||||
>>> output.product = product
|
>>> output.product = product
|
||||||
>>> output.quantity = 1
|
>>> output.quantity = 1
|
||||||
>>> bom.drawing = drawing
|
>>> bom.drawing = drawing
|
||||||
>>> names = [str(x.position.name) for x in bom.drawing_positions]
|
>>> names = [str(x.position.name) for x in bom.drawing_lines]
|
||||||
>>> sorted(names)
|
>>> sorted(names)
|
||||||
['R1', 'R2']
|
['R1', 'R2']
|
||||||
>>> bom.drawing_positions[0].product = component1
|
|
||||||
>>> bom.drawing_positions[1].product = component2
|
|
||||||
>>> bom.save()
|
|
||||||
>>> bom.reload()
|
|
||||||
|
|
|
@ -3,29 +3,22 @@
|
||||||
import unittest
|
import unittest
|
||||||
import doctest
|
import doctest
|
||||||
import trytond.tests.test_tryton
|
import trytond.tests.test_tryton
|
||||||
from trytond.tests.test_tryton import test_view, test_depends
|
from trytond.tests.test_tryton import ModuleTestCase
|
||||||
from trytond.tests.test_tryton import doctest_setup, doctest_teardown
|
from trytond.tests.test_tryton import doctest_teardown
|
||||||
|
from trytond.tests.test_tryton import doctest_checker
|
||||||
|
|
||||||
|
|
||||||
class TestCase(unittest.TestCase):
|
class ProductionDrawingTestCase(ModuleTestCase):
|
||||||
'Test module'
|
'Test module'
|
||||||
|
module = 'production_drawing'
|
||||||
def setUp(self):
|
|
||||||
trytond.tests.test_tryton.install_module('production_drawing')
|
|
||||||
|
|
||||||
def test0005views(self):
|
|
||||||
'Test views'
|
|
||||||
test_view('production_drawing')
|
|
||||||
|
|
||||||
def test0006depends(self):
|
|
||||||
'Test depends'
|
|
||||||
test_depends()
|
|
||||||
|
|
||||||
|
|
||||||
def suite():
|
def suite():
|
||||||
suite = trytond.tests.test_tryton.suite()
|
suite = trytond.tests.test_tryton.suite()
|
||||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestCase))
|
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
|
||||||
|
ProductionDrawingTestCase))
|
||||||
suite.addTests(doctest.DocFileSuite('scenario_production.rst',
|
suite.addTests(doctest.DocFileSuite('scenario_production.rst',
|
||||||
setUp=doctest_setup, tearDown=doctest_teardown, encoding='utf-8',
|
tearDown=doctest_teardown, encoding='utf-8',
|
||||||
|
checker=doctest_checker,
|
||||||
optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
|
optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
|
||||||
return suite
|
return suite
|
||||||
|
|
|
@ -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}
|
|
@ -2,9 +2,6 @@
|
||||||
<!-- The COPYRIGHT file at the top level of this repository contains the full
|
<!-- The COPYRIGHT file at the top level of this repository contains the full
|
||||||
copyright notices and license terms. -->
|
copyright notices and license terms. -->
|
||||||
<form>
|
<form>
|
||||||
<label name="bom"/>
|
|
||||||
<field name="bom"/>
|
|
||||||
<newline/>
|
|
||||||
<label name="position"/>
|
<label name="position"/>
|
||||||
<field name="position"/>
|
<field name="position"/>
|
||||||
<label name="product"/>
|
<label name="product"/>
|
||||||
|
|
Loading…
Reference in New Issue