Update to 4.8 [CI SKIP]

This commit is contained in:
Javier Uribe 2018-07-24 11:24:26 +02:00
parent 6a2611d8df
commit 3021ed4509
6 changed files with 90 additions and 13 deletions

View File

@ -7,7 +7,8 @@ pipeline:
image: ${IMAGE}
environment:
- CFLAGS=-O0
- TOX_TESTENV_PASSENV=CFLAGS
- DB_CACHE=/cache
- TOX_TESTENV_PASSENV=CFLAGS DB_CACHE
- POSTGRESQL_URI=postgresql://postgres@postgresql:5432/
commands:
- python tests/netrc2hgrc.py

View File

@ -2,7 +2,8 @@
# the full copyright notices and license terms.
from trytond.pool import Pool
from .edocument import Message
from .stock import Configuration, UnitLoad
from .stock import (Configuration, ConfigurationSequence,
ConfigurationEDIOutputPath, UnitLoad)
from .party import PartyIdentifier, Address
from .product import Template
from .incoterm import Rule
@ -13,6 +14,8 @@ def register():
Message,
PartyIdentifier,
Configuration,
ConfigurationSequence,
ConfigurationEDIOutputPath,
Rule,
Template,
Address,

View File

@ -16,10 +16,5 @@
<field name="name">Electronic Document sequence</field>
<field name="code">edocument.message</field>
</record>
<record model="ir.property" id="property_edocument_sequence">
<field name="field"
search="[('model.model', '=', 'stock.configuration'), ('name', '=', 'edocument_sequence')]"/>
<field name="value" eval="'ir.sequence,' + str(ref('sequence_edocument'))"/>
</record>
</data>
</tryton>

View File

@ -1,18 +1,95 @@
# The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.model import fields
from trytond.pool import PoolMeta
from trytond.model import fields, ModelSQL
from trytond.pool import PoolMeta, Pool
from trytond.tools.multivalue import migrate_property
from trytond.modules.company.model import CompanyValueMixin
from trytond import backend
__all__ = ['Configuration', 'UnitLoad']
__all__ = ['Configuration', 'ConfigurationSequence', 'UnitLoad',
'ConfigurationEDIOutputPath']
class Configuration:
__metaclass__ = PoolMeta
__name__ = 'stock.configuration'
edocument_sequence = fields.Property(
edocument_sequence = fields.MultiValue(
fields.Many2One('ir.sequence', 'Electronic Document Sequence',
required=True))
EDI_output_path = fields.Property(fields.Char('EDI Output Path'))
EDI_output_path = fields.MultiValue(fields.Char('EDI Output Path'))
@classmethod
def multivalue_model(cls, field):
pool = Pool()
if field == 'edocument_sequence':
return pool.get('stock.configuration.sequence')
return super(Configuration, cls).multivalue_model(field)
@classmethod
def default_edocument_sequence(cls, **pattern):
return cls.multivalue_model(
'edocument_sequence').default_edocument_sequence()
class ConfigurationSequence:
__name__ = 'stock.configuration.sequence'
__metaclass__ = PoolMeta
edocument_sequence = fields.Many2One('ir.sequence',
'Electronic Document Sequence', required=True)
@classmethod
def __register__(cls, module_name):
TableHandler = backend.get('TableHandler')
exist = TableHandler.table_exist(cls._table)
super(ConfigurationSequence, cls).__register__(module_name)
if not exist:
cls._migrate_property([], [], [])
@classmethod
def _migrate_property(cls, field_names, value_names, fields):
field_names.append('edocument_sequence')
value_names.append('edocument_sequence')
fields.append('company')
migrate_property('stock.configuration',
field_names, cls, value_names, fields=fields)
@classmethod
def default_edocument_sequence(cls):
pool = Pool()
ModelData = pool.get('ir.model.data')
try:
return ModelData.get_id('edocument_edifact', 'sequence_edocument')
except KeyError:
return None
class ConfigurationEDIOutputPath(ModelSQL, CompanyValueMixin):
"""Stock Configuration EDI Output Path"""
__name__ = 'stock.configuration.EDI_output_path'
EDI_output_path = fields.Char('EDI Output Path')
@classmethod
def __register__(cls, module_name):
TableHandler = backend.get('TableHandler')
exist = TableHandler.table_exist(cls._table)
super(ConfigurationEDIOutputPath, cls).__register__(module_name)
if not exist:
cls._migrate_property([], [], [])
@classmethod
def _migrate_property(cls, field_names, value_names, fields):
field_names.append('EDI_output_path')
value_names.append('EDI_output_path')
fields.append('company')
migrate_property('stock.configuration',
field_names, cls, value_names, fields=fields)
class UnitLoad:

View File

@ -7,6 +7,7 @@ deps =
{py27,py34,py35,py36}-postgresql: psycopg2 >= 2.5
pypy-postgresql: psycopg2cffi >= 2.5
mysql: MySQL-python
sqlite: sqlitebck
setenv =
sqlite: TRYTOND_DATABASE_URI={env:SQLITE_URI:sqlite://}
postgresql: TRYTOND_DATABASE_URI={env:POSTGRESQL_URI:postgresql://}

View File

@ -1,5 +1,5 @@
[tryton]
version=4.2.0
version=4.8.0
depends:
ir
res