Update to 4.8 [CI SKIP]

This commit is contained in:
Javier Uribe 2018-07-17 08:52:16 +02:00
parent 68076628ce
commit 9a38cccf8b
9 changed files with 145 additions and 24 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:
- pip install tox

View File

@ -1,7 +1,8 @@
# The COPYRIGHT file at the top level of this repository contains the full
# copyright notices and license terms.
from trytond.pool import Pool
from .configuration import Configuration
from .configuration import (Configuration, ConfigurationSequence,
ConfigurationULProductionType)
from .unit_load import (UnitLoad, UnitLoadMove, MoveUnitLoad,
MoveUnitLoadStart, UnitLoadLabel, DropUnitLoad,
DropUnitLoadStart, DropUnitLoadFailed, DropUnitLoadFailedProduct,
@ -14,6 +15,8 @@ from .shipment import ShipmentOut, ShipmentInternal
def register():
Pool.register(
Configuration,
ConfigurationSequence,
ConfigurationULProductionType,
UnitLoad,
UnitLoadMove,
Move,

View File

@ -1,24 +1,113 @@
# 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.pyson import Id, Eval
from trytond.model import ModelSQL, fields
from trytond.pool import PoolMeta, Pool
from trytond.pyson import Eval
from trytond.tools.multivalue import migrate_property
from trytond.modules.company.model import CompanyValueMixin
from trytond import backend
__all__ = ['Configuration']
__all__ = ['Configuration', 'ConfigurationSequence',
'ConfigurationULProductionType']
class Configuration:
__name__ = 'stock.configuration'
__metaclass__ = PoolMeta
unit_load_sequence = fields.Property(
unit_load_sequence = fields.MultiValue(
fields.Many2One('ir.sequence', 'Load unit Sequence', required=True,
domain=[('code', '=', 'stock.unit_load'),
('company', 'in',
[Eval('context', {}).get('company', -1), None])]))
ul_production_type = fields.Property(
fields.Selection([('location', 'Location')], 'UL Production type', required=True))
domain=[('code', '=', 'stock.unit_load'),
('company', 'in',
[Eval('context', {}).get(
'company', -1), None])]))
ul_production_type = fields.MultiValue(
fields.Selection([('location', 'Location')],
'UL Production type', required=True))
@classmethod
def multivalue_model(cls, field):
pool = Pool()
if field == 'unit_load_sequence':
return pool.get('stock.configuration.sequence')
return super(Configuration, cls).multivalue_model(field)
@classmethod
def default_unit_load_sequence(cls, **pattern):
return cls.multivalue_model(
'unit_load_sequence').default_unit_load_sequence()
@classmethod
def default_ul_production_type(cls, **pattern):
return cls.multivalue_model(
'ul_production_type').default_ul_production_type()
class ConfigurationSequence:
__name__ = 'stock.configuration.sequence'
__metaclass__ = PoolMeta
unit_load_sequence = fields.Many2One('ir.sequence',
'Load unit Sequence', required=True,
domain=[('code', '=', 'stock.unit_load'),
('company', 'in',
[Eval('context', {}).get(
'company', -1), None])])
@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('unit_load_sequence')
value_names.append('unit_load_sequence')
fields.append('company')
migrate_property('stock.configuration',
field_names, cls, value_names, fields=fields)
@classmethod
def default_unit_load_sequence(cls):
pool = Pool()
ModelData = pool.get('ir.model.data')
try:
return ModelData.get_id('stock_unit_load', 'sequence_unit_load')
except KeyError:
return None
class ConfigurationULProductionType(ModelSQL, CompanyValueMixin):
"Stock Configuration UL Production Type"
__name__ = 'stock.configuration.ul_production_type'
ul_production_type = fields.Selection([('location', 'Location')],
'UL Production type', required=True)
@classmethod
def __register__(cls, module_name):
TableHandler = backend.get('TableHandler')
exist = TableHandler.table_exist(cls._table)
super(ConfigurationULProductionType, cls).__register__(module_name)
if not exist:
cls._migrate_property([], [], [])
@classmethod
def _migrate_property(cls, field_names, value_names, fields):
field_names.extend('ul_production_type')
value_names.extend('ul_production_type')
fields.append('company')
migrate_property('stock.configuration',
field_names, cls, value_names, fields=fields)
@classmethod
def default_ul_production_type(cls):
return 'location'

View File

@ -31,9 +31,5 @@
<field name="name">Unit load</field>
<field name="code">stock.unit_load</field>
</record>
<record model="ir.property" id="property_unit_load">
<field name="field" search="[('model.model', '=', 'stock.configuration'), ('name', '=', 'unit_load_sequence')]"/>
<field name="value" eval="'ir.sequence,' + str(ref('sequence_unit_load'))"/>
</record>
</data>
</tryton>

View File

@ -47,5 +47,36 @@
<field name="view" ref="unit_load_view_form"/>
<field name="act_window" ref="act_uls_by_locations"/>
</record>
<!-- Buttons -->
<record model="ir.model.button" id="unit_load_move_try_button">
<field name="name">move_try</field>
<field name="string">Move</field>
<field name="model" search="[('model', '=', 'stock.unit_load')]"/>
</record>
<record model="ir.model.button" id="unit_load_assign_button">
<field name="name">assign</field>
<field name="string">Assign</field>
<field name="model" search="[('model', '=', 'stock.unit_load')]"/>
</record>
<record model="ir.model.button" id="unit_load_drop_wizard_button">
<field name="name">drop_wizard</field>
<field name="string">Drop</field>
<field name="model" search="[('model', '=', 'stock.unit_load')]"/>
</record>
<record model="ir.model.button" id="unit_load_do_button">
<field name="name">do</field>
<field name="string">Done</field>
<field name="model" search="[('model', '=', 'stock.unit_load')]"/>
</record>
<record model="ir.model.button" id="unit_load_draft_button">
<field name="name">draft</field>
<field name="string">Reset to Draft</field>
<field name="model" search="[('model', '=', 'stock.unit_load')]"/>
</record>
<record model="ir.model.button" id="unit_load_cancel_button">
<field name="name">cancel</field>
<field name="string">Cancel last move</field>
<field name="model" search="[('model', '=', 'stock.unit_load')]"/>
</record>
</data>
</tryton>

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

View File

@ -2,7 +2,7 @@
<!-- The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="/form/notebook/page[@id='inventory_moves']" position="before">
<xpath expr="/form/notebook/page[@name='inventory_moves']" position="before">
<page id="uls" string="ULs">
<field name="unit_loads" colspan="4" widget="many2many"/>
</page>

View File

@ -58,12 +58,12 @@
<field name="production_state"/>
</group>
<group col="5" colspan="2" id="buttons">
<button string="Cancel last move" name="cancel" confirm="Last moves will be deleted." />
<button string="Reset to Draft" name="draft"/>
<button string="Move" name="move_try"/>
<button string="Drop" name="drop_wizard"/>
<button string="Assign" name="assign" />
<button string="Done" name="do" />
<button name="cancel" confirm="Last moves will be deleted." />
<button name="draft"/>
<button name="move_try"/>
<button name="drop_wizard"/>
<button name="assign" />
<button name="do" />
</group>
</group>
</form>