Create model edocument configuration path and move edocument configuration paths to it.
This commit refs #27778
This commit is contained in:
parent
90b211de65
commit
b54198cc0d
|
@ -13,13 +13,13 @@ def register():
|
|||
Pool.register(
|
||||
configuration.Configuration,
|
||||
configuration.ConfigurationSequence,
|
||||
configuration.ConfigurationPath,
|
||||
edocument.EdocumentMessage,
|
||||
edocument.EdocumentTemplate,
|
||||
party.Party,
|
||||
party.PartyIdentifier,
|
||||
stock.Configuration,
|
||||
stock.ConfigurationSequence,
|
||||
stock.ConfigurationEDIOutputPath,
|
||||
product.Template,
|
||||
product.Product,
|
||||
module='edocument_edifact', type_='model')
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
# The COPYRIGHT file at the top level of this repository contains the full
|
||||
# copyright notices and license terms.
|
||||
from trytond.model import ModelSQL, ModelSingleton, ModelView, fields
|
||||
from trytond.model import ModelSQL, ModelSingleton, ModelView, fields, Unique
|
||||
from trytond.pool import Pool
|
||||
from trytond.pyson import Id
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.i18n import gettext
|
||||
from trytond.exceptions import UserError
|
||||
from trytond.modules.company.model import (
|
||||
CompanyMultiValueMixin, CompanyValueMixin)
|
||||
|
||||
|
@ -18,9 +21,6 @@ class Configuration(
|
|||
('sequence_type', '=', Id('edocument_edifact',
|
||||
'sequence_type_edocument'))
|
||||
]))
|
||||
export_path = fields.Char('Export Path')
|
||||
import_path = fields.Char('Import Path')
|
||||
error_path = fields.Char('Error Path')
|
||||
|
||||
@classmethod
|
||||
def multivalue_model(cls, field):
|
||||
|
@ -49,3 +49,74 @@ class ConfigurationSequence(ModelSQL, CompanyValueMixin):
|
|||
return ModelData.get_id('edocument_edifact', 'sequence_edocument')
|
||||
except KeyError:
|
||||
return None
|
||||
|
||||
|
||||
class ConfigurationPath(ModelSQL, ModelView):
|
||||
"""Electronic Document configuration path"""
|
||||
__name__ = 'edocument.configuration.path'
|
||||
|
||||
message_type = fields.Selection([], 'Document', required=True)
|
||||
path = fields.Char('Path')
|
||||
error_path = fields.Char('Errors path')
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super().__setup__()
|
||||
t = cls.__table__()
|
||||
cls._sql_constraints += [
|
||||
('messsage_type_uniq', Unique(t, t.message_type),
|
||||
'edocument_edifact.msg_message_type_unique'),
|
||||
]
|
||||
|
||||
@classmethod
|
||||
def __register__(cls, module_name):
|
||||
pool = Pool()
|
||||
EdocumentConfiguration = pool.get('edocument.configuration')
|
||||
|
||||
super().__register__(module_name)
|
||||
|
||||
sql_table = cls.__table__()
|
||||
edocument_table = EdocumentConfiguration.__table_handler__(module_name)
|
||||
edocument_config_table = EdocumentConfiguration.__table__()
|
||||
cursor = Transaction().connection.cursor()
|
||||
|
||||
if (edocument_table.column_exist('export_path')
|
||||
and edocument_table.column_exist('error_path')):
|
||||
cursor.execute(*edocument_config_table.select(
|
||||
edocument_config_table.create_date,
|
||||
edocument_config_table.write_date,
|
||||
edocument_config_table.export_path,
|
||||
edocument_config_table.error_path))
|
||||
sql_values = cursor.fetchall()
|
||||
message_type = cls.get_message_type_values()
|
||||
if message_type:
|
||||
cursor.execute(*sql_table.select(
|
||||
sql_table.message_type))
|
||||
types = set(message_type) - set(
|
||||
msg[0] for msg in cursor.fetchall())
|
||||
for type_ in list(types):
|
||||
sql_values_insert = sql_values[0] + (type_,)
|
||||
cursor.execute(*sql_table.insert(columns=[
|
||||
sql_table.create_date,
|
||||
sql_table.write_date,
|
||||
sql_table.path,
|
||||
sql_table.error_path,
|
||||
sql_table.message_type
|
||||
],
|
||||
values=[sql_values_insert]))
|
||||
|
||||
@classmethod
|
||||
def get_message_type_values(cls):
|
||||
return [value[0] for value in cls.fields_get(
|
||||
['message_type'])['message_type']['selection']]
|
||||
|
||||
@classmethod
|
||||
def _get_path(cls, message_type, check_values=[]):
|
||||
config, = cls.search([
|
||||
('message_type', '=', message_type)]) or [None]
|
||||
if (not config or any(not getattr(config, fvalue, None)
|
||||
for fvalue in check_values)):
|
||||
raise UserError(
|
||||
gettext('edocument_edifact.msg_message_type_path_required'),
|
||||
message_type=message_type)
|
||||
return config
|
||||
|
|
44
edocument.py
44
edocument.py
|
@ -21,8 +21,7 @@ class EdocumentTemplate(ModelView, ModelSQL):
|
|||
"""Electronic Document Template"""
|
||||
__name__ = 'edocument.template'
|
||||
|
||||
message_type = fields.Selection([('DESADV', 'DESADV'),
|
||||
('INVOIC', 'INVOIC')], 'Document', required=True)
|
||||
message_type = fields.Selection([], 'Document', required=True)
|
||||
party = fields.Many2One('party.party', 'Party')
|
||||
template = fields.Text('Template')
|
||||
encoding = fields.Selection([
|
||||
|
@ -140,18 +139,10 @@ class EdocumentImportMixin(EdocumentMixin):
|
|||
pass
|
||||
|
||||
@classmethod
|
||||
def _source_uri(cls):
|
||||
def _get_path(cls, message_type):
|
||||
pool = Pool()
|
||||
Configuration = pool.get('edocument.configuration')
|
||||
config = Configuration(0)
|
||||
return config.import_path
|
||||
|
||||
@classmethod
|
||||
def _error_uri(cls):
|
||||
pool = Pool()
|
||||
Configuration = pool.get('edocument.configuration')
|
||||
config = Configuration(0)
|
||||
return config.error_path
|
||||
Configuration = pool.get('edocument.configuration.path')
|
||||
return Configuration._get_path()
|
||||
|
||||
@classmethod
|
||||
def _template(cls):
|
||||
|
@ -205,11 +196,12 @@ class EdocumentImportMixin(EdocumentMixin):
|
|||
return objects
|
||||
|
||||
@classmethod
|
||||
def get_objects_from_edi(cls, target_model=None):
|
||||
def get_objects_from_edi(cls, message_type, target_model=None):
|
||||
'''Get objects from edi'''
|
||||
conf = cls._get_path(message_type)
|
||||
results = cls._create_objects_from_edi(
|
||||
cls._source_uri(),
|
||||
cls._error_uri(),
|
||||
conf.path,
|
||||
conf.error_path,
|
||||
target_model=target_model)
|
||||
cls.postprocess(results)
|
||||
return results
|
||||
|
@ -275,13 +267,16 @@ class EdocumentExportMixin(object):
|
|||
pool = Pool()
|
||||
ActiveModel = self.model
|
||||
Message = pool.get('edocument.message')
|
||||
Configuration = pool.get('edocument.configuration.path')
|
||||
|
||||
domain = [('id', 'in', Transaction().context['active_ids'])]
|
||||
if not export_again:
|
||||
domain.append(('edocument_processed', '=', False))
|
||||
|
||||
records = ActiveModel.search(domain)
|
||||
if not records:
|
||||
return None, None
|
||||
|
||||
companies = set(x.company for x in records)
|
||||
if len(companies) > 1:
|
||||
raise UserError(gettext('edocument_edifact.msg_company_unique'))
|
||||
|
@ -298,6 +293,7 @@ class EdocumentExportMixin(object):
|
|||
if not edifact_receiver:
|
||||
raise UserError(gettext('edocument_edifact.msg_party_EDI_receiver',
|
||||
party=party.name))
|
||||
|
||||
template, encoding = self._edi_template(message_type, party)
|
||||
loader = TextTemplate(template)
|
||||
for record in records:
|
||||
|
@ -316,14 +312,14 @@ class EdocumentExportMixin(object):
|
|||
data=data, items=[1, 2, 3]).render()
|
||||
message.save()
|
||||
record.save()
|
||||
conf = Pool().get('edocument.configuration')(0)
|
||||
if conf.export_path:
|
||||
chars = ['.', ' ', '-', ':']
|
||||
f_name = ''.join(
|
||||
[c for c in str(datetime.now()) if c not in chars])
|
||||
name = 'EDI' + f_name + ".edi"
|
||||
file_name = os.path.join(conf.export_path, name)
|
||||
self._write_file(file_name, message.message, encoding=encoding)
|
||||
|
||||
conf = Configuration._get_path(message_type)
|
||||
chars = ['.', ' ', '-', ':']
|
||||
f_name = ''.join(
|
||||
[c for c in str(datetime.now()) if c not in chars])
|
||||
name = 'EDI' + f_name + ".edi"
|
||||
file_name = os.path.join(conf.path, name)
|
||||
self._write_file(file_name, message.message, encoding=encoding)
|
||||
if not message.code:
|
||||
raise UserError(gettext('edocument_edifact.msg_EDI_sequence'))
|
||||
return message.message, message_type + message.code + '.EDI'
|
||||
|
|
|
@ -64,19 +64,17 @@
|
|||
<record model="ir.ui.view" id="edocument_configuration_view_form">
|
||||
<field name="model">edocument.configuration</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">configuration_form</field>
|
||||
<field name="name">edocument_configuration_form</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.action.act_window" id="act_edocument_configuration_form">
|
||||
<field name="name">Edocument Configuration</field>
|
||||
<field name="res_model">edocument.configuration</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_edocument_configuration_form_view">
|
||||
<field name="sequence" eval="20"/>
|
||||
<field name="sequence" eval="10"/>
|
||||
<field name="view" ref="edocument_configuration_view_form"/>
|
||||
<field name="act_window" ref="act_edocument_configuration_form"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.model.access" id="access_edocument_configuration">
|
||||
<field name="model" search="[('model', '=', 'edocument.configuration')]"/>
|
||||
<field name="perm_read" eval="True"/>
|
||||
|
@ -97,14 +95,45 @@
|
|||
name="Edocument" id="menu_edocument" icon="tryton-folder"/>
|
||||
<menuitem parent="menu_edocument" sequence="0"
|
||||
name="Configuration" id="menu_configuration" icon="tryton-settings"/>
|
||||
<menuitem parent="menu_configuration" sequence="10" id="menu_edocument_configuration"
|
||||
action="act_edocument_configuration_form"/>
|
||||
<menuitem parent="menu_edocument" sequence="10" id="menu_edocument_template"
|
||||
<menuitem parent="menu_configuration" sequence="0" id="menu_edocument_configuration"
|
||||
name="Configuration" action="act_edocument_configuration_form"/>
|
||||
<menuitem parent="menu_edocument" sequence="10" id="menu_edocument_template" name="Templates"
|
||||
action="act_edocument_template_form"/>
|
||||
|
||||
<record model="ir.ui.menu-res.group" id="menu_edocument_group_admin">
|
||||
<field name="menu" ref="menu_edocument"/>
|
||||
<field name="group" ref="res.group_admin"/>
|
||||
</record>
|
||||
<!-- Edocument configuration path -->
|
||||
<record model="ir.ui.view" id="account_edocument_configuration_path_view_form">
|
||||
<field name="model">edocument.configuration.path</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">edocument_configuration_path_form</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="account_edocument_configuration_path_view_tree">
|
||||
<field name="model">edocument.configuration.path</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="name">edocument_configuration_path_tree</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window" id="act_edocument_configuration_path">
|
||||
<field name="name">Edocument Paths</field>
|
||||
<field name="res_model">edocument.configuration.path</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_edocument_configuration_path_list_view">
|
||||
<field name="sequence" eval="10"/>
|
||||
<field name="view" ref="account_edocument_configuration_path_view_tree"/>
|
||||
<field name="act_window" ref="act_edocument_configuration_path"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_edocument_configuration_path_form_view">
|
||||
<field name="sequence" eval="20"/>
|
||||
<field name="view" ref="account_edocument_configuration_path_view_form"/>
|
||||
<field name="act_window" ref="act_edocument_configuration_path"/>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Paths"
|
||||
parent="menu_configuration"
|
||||
action="act_edocument_configuration_path"
|
||||
sequence="10" icon="tryton-list"
|
||||
id="menu_edocument_configuration_path"/>
|
||||
</data>
|
||||
</tryton>
|
106
locale/es.po
106
locale/es.po
|
@ -38,6 +38,14 @@ msgctxt "model:ir.message,text:msg_customer_EDI_receiver"
|
|||
msgid "Customer \"%(customer)s\" lacks EDI receiver identifier"
|
||||
msgstr "El cliente \"%(customer)s\" no tiene identificador de receptor EDI."
|
||||
|
||||
msgctxt "model:ir.message,text:msg_message_type_unique"
|
||||
msgid "Message type must be unique."
|
||||
msgstr "Tipo de mensaje debe ser único."
|
||||
|
||||
msgctxt "model:ir.message,text:msg_message_type_path_required"
|
||||
msgid "Path for EDI files of message type \"%(message_type)s\" not defined."
|
||||
msgstr "No se ha definido ruta de ficheros EDI para el tipo de mensaje \"%(message_type)s\"."
|
||||
|
||||
msgctxt "field:edocument.configuration,create_date:"
|
||||
msgid "Create Date"
|
||||
msgstr "Fecha de creación"
|
||||
|
@ -90,10 +98,6 @@ msgctxt "field:edocument.configuration.sequence,create_uid:"
|
|||
msgid "Create User"
|
||||
msgstr "Usuario de creación"
|
||||
|
||||
msgctxt "field:edocument.configuration.sequence,edocument_sequence:"
|
||||
msgid "Electronic Document Sequence"
|
||||
msgstr "Secuencia Documentación Electrónica"
|
||||
|
||||
msgctxt "field:edocument.configuration.sequence,id:"
|
||||
msgid "ID"
|
||||
msgstr "Identificador"
|
||||
|
@ -110,6 +114,30 @@ msgctxt "field:edocument.configuration.sequence,write_uid:"
|
|||
msgid "Write User"
|
||||
msgstr "Usuario que escribe."
|
||||
|
||||
msgctxt "field:edocument.configuration.path,path:"
|
||||
msgid "Path"
|
||||
msgstr "Ruta"
|
||||
|
||||
msgctxt "field:edocument.configuration.path,error_path:"
|
||||
msgid "Errors path"
|
||||
msgstr "Ruta errores"
|
||||
|
||||
msgctxt "field:edocument.configuration.path,message_type:"
|
||||
msgid "Document"
|
||||
msgstr "Documento"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_edocument_configuration_path"
|
||||
msgid "Paths"
|
||||
msgstr "Rutas"
|
||||
|
||||
msgctxt "model:ir.action,name:act_edocument_configuration_path"
|
||||
msgid "Edocument Paths"
|
||||
msgstr "Rutas documentación electrónica"
|
||||
|
||||
msgctxt "model:edocument.configuration.path,name:"
|
||||
msgid "Edocument configuration path"
|
||||
msgstr "Configuración rutas documentación electrónica"
|
||||
|
||||
msgctxt "field:edocument.message,code:"
|
||||
msgid "Code"
|
||||
msgstr "Código"
|
||||
|
@ -222,53 +250,9 @@ msgctxt "field:product.template,EDI_code:"
|
|||
msgid "EDI Code"
|
||||
msgstr "Código EDI"
|
||||
|
||||
msgctxt "field:stock.configuration,EDI_output_path:"
|
||||
msgid "EDI Output Path"
|
||||
msgstr "Ruta Salida EDI"
|
||||
|
||||
msgctxt "field:stock.configuration,edocument_sequence:"
|
||||
msgid "Electronic Document Sequence"
|
||||
msgstr "Secuencia Documentación Electrónica"
|
||||
|
||||
msgctxt "field:stock.configuration.edi_output_path,EDI_output_path:"
|
||||
msgid "EDI Output Path"
|
||||
msgstr "Ruta Salida EDI"
|
||||
|
||||
msgctxt "field:stock.configuration.edi_output_path,company:"
|
||||
msgid "Company"
|
||||
msgstr "Empresa"
|
||||
|
||||
msgctxt "field:stock.configuration.edi_output_path,create_date:"
|
||||
msgid "Create Date"
|
||||
msgstr "Fecha de creación"
|
||||
|
||||
msgctxt "field:stock.configuration.edi_output_path,create_uid:"
|
||||
msgid "Create User"
|
||||
msgstr "Usuario de creación"
|
||||
|
||||
msgctxt "field:stock.configuration.edi_output_path,id:"
|
||||
msgid "ID"
|
||||
msgstr "Identificador"
|
||||
|
||||
msgctxt "field:stock.configuration.edi_output_path,rec_name:"
|
||||
msgid "Record Name"
|
||||
msgstr "Nombre registro"
|
||||
|
||||
msgctxt "field:stock.configuration.edi_output_path,write_date:"
|
||||
msgid "Write Date"
|
||||
msgstr "Fecha modificación"
|
||||
|
||||
msgctxt "field:stock.configuration.edi_output_path,write_uid:"
|
||||
msgid "Write User"
|
||||
msgstr "Usuario que escribe."
|
||||
|
||||
msgctxt "field:stock.configuration.sequence,edocument_sequence:"
|
||||
msgid "Electronic Document Sequence"
|
||||
msgstr "Secuencia Documentación Electrónica"
|
||||
|
||||
msgctxt "model:edocument.configuration,name:"
|
||||
msgid "Edocument Configuration"
|
||||
msgstr "Configuración de Documentación Electrónica"
|
||||
msgstr "Configuración de documentación electrónica"
|
||||
|
||||
msgctxt "model:edocument.configuration.sequence,name:"
|
||||
msgid "Edocument Configuration Sequence"
|
||||
|
@ -283,8 +267,8 @@ msgid "Electronic Document Template"
|
|||
msgstr "Plantilla de Documentación Electrónica"
|
||||
|
||||
msgctxt "model:ir.action,name:act_edocument_configuration_form"
|
||||
msgid "Edocument Configuration"
|
||||
msgstr "Configuración de Documentación Electrónica"
|
||||
msgid "Configuration"
|
||||
msgstr "Configuración"
|
||||
|
||||
msgctxt "model:ir.action,name:act_edocument_template_form"
|
||||
msgid "Edocument Templates"
|
||||
|
@ -307,24 +291,12 @@ msgid "Edocument"
|
|||
msgstr "Documentación Electrónica"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_edocument_configuration"
|
||||
msgid "Edocument Configuration"
|
||||
msgstr "Configuración de Documentación Electrónica"
|
||||
msgid "Configuration"
|
||||
msgstr "Configuración"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_edocument_template"
|
||||
msgid "Edocument Templates"
|
||||
msgstr "Plantillas de Documentación Electrónica"
|
||||
|
||||
msgctxt "model:stock.configuration.edi_output_path,name:"
|
||||
msgid "Stock Configuration EDI Output Path"
|
||||
msgstr "Configuración Stock Ruta Salida EDI"
|
||||
|
||||
msgctxt "selection:edocument.template,message_type:"
|
||||
msgid "DESADV"
|
||||
msgstr "DESADV"
|
||||
|
||||
msgctxt "selection:edocument.template,message_type:"
|
||||
msgid "INVOIC"
|
||||
msgstr "INVOIC"
|
||||
msgid "Templates"
|
||||
msgstr "Plantillas"
|
||||
|
||||
msgctxt "selection:party.identifier,type:"
|
||||
msgid "EDI Buyer"
|
||||
|
|
|
@ -30,5 +30,11 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<record model="ir.message" id="msg_EDI_export_path">
|
||||
<field name="text">EDI export path is not defined in Edocument Configuration.</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_message_type_unique">
|
||||
<field name="text">Message type must be unique.</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_message_type_path_required">
|
||||
<field name="text">Path for EDI files of message type "%(message_type)s" not defined.</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
75
stock.py
75
stock.py
|
@ -1,47 +1,24 @@
|
|||
# The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
from trytond.model import fields, ModelSQL
|
||||
from trytond.pool import PoolMeta, Pool
|
||||
from trytond.pyson import Id
|
||||
from trytond.tools.multivalue import migrate_property
|
||||
from trytond.modules.company.model import CompanyValueMixin
|
||||
from trytond.pool import PoolMeta
|
||||
|
||||
|
||||
class Configuration(metaclass=PoolMeta):
|
||||
__name__ = 'stock.configuration'
|
||||
|
||||
edocument_sequence = fields.MultiValue(
|
||||
fields.Many2One('ir.sequence', 'Electronic Document Sequence',
|
||||
required=True, domain=[
|
||||
('sequence_type', '=', Id('edocument_edifact',
|
||||
'sequence_type_edocument'))
|
||||
]))
|
||||
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')
|
||||
elif field == 'EDI_output_path':
|
||||
return pool.get('stock.configuration.edi_output_path')
|
||||
return super(Configuration, cls).multivalue_model(field)
|
||||
def __register__(cls, module_name):
|
||||
super().__register__(module_name)
|
||||
|
||||
@classmethod
|
||||
def default_edocument_sequence(cls, **pattern):
|
||||
return cls.multivalue_model(
|
||||
'edocument_sequence').default_edocument_sequence()
|
||||
table = cls.__table_handler__(module_name)
|
||||
for field in ['edocument_sequence', 'EDI_output_path']:
|
||||
if table.column_exist(field):
|
||||
table.drop_column(field)
|
||||
|
||||
|
||||
class ConfigurationSequence(metaclass=PoolMeta):
|
||||
__name__ = 'stock.configuration.sequence'
|
||||
|
||||
edocument_sequence = fields.Many2One('ir.sequence',
|
||||
'Electronic Document Sequence', required=True, domain=[
|
||||
('sequence_type', '=', Id('edocument_edifact',
|
||||
'sequence_type_edocument'))
|
||||
])
|
||||
|
||||
@classmethod
|
||||
def __register__(cls, module_name):
|
||||
table_h = cls.__table_handler__(module_name)
|
||||
|
@ -49,8 +26,10 @@ class ConfigurationSequence(metaclass=PoolMeta):
|
|||
if exist:
|
||||
exist &= table_h.column_exist('edocument_sequence')
|
||||
|
||||
super(ConfigurationSequence, cls).__register__(module_name)
|
||||
super().__register__(module_name)
|
||||
|
||||
if table_h.column_exist('edocument_sequence'):
|
||||
table_h.drop_column('edocument_sequence')
|
||||
if not exist:
|
||||
# Re-migration
|
||||
cls._migrate_property([], [], [])
|
||||
|
@ -61,37 +40,3 @@ class ConfigurationSequence(metaclass=PoolMeta):
|
|||
value_names.append('edocument_sequence')
|
||||
super(ConfigurationSequence, cls)._migrate_property(field_names,
|
||||
value_names, 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):
|
||||
table_h = cls.__table_handler__(module_name)
|
||||
exist = table_h.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)
|
||||
|
|
12
stock.xml
12
stock.xml
|
@ -1,12 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- The COPYRIGHT file at the top level of this repository contains the full
|
||||
copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="stock_configuration_view_form">
|
||||
<field name="model">stock.configuration</field>
|
||||
<field name="inherit" ref="stock.stock_configuration_view_form"/>
|
||||
<field name="name">configuration_form</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
|
@ -13,7 +13,6 @@ extras_depend:
|
|||
product_cross_reference
|
||||
|
||||
xml:
|
||||
stock.xml
|
||||
incoterm.xml
|
||||
edocument.xml
|
||||
party.xml
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- The COPYRIGHT file at the top level of this repository contains the full
|
||||
copyright notices and license terms. -->
|
||||
<form>
|
||||
<form col="4">
|
||||
<label name="edocument_sequence"/>
|
||||
<field name="edocument_sequence"/>
|
||||
<label name="import_path"/>
|
||||
<field name="import_path"/>
|
||||
<label name="export_path"/>
|
||||
<field name="export_path"/>
|
||||
<label name="error_path"/>
|
||||
<field name="error_path"/>
|
||||
</form>
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- The COPYRIGHT file at the top level of this repository contains the full
|
||||
copyright notices and license terms. -->
|
||||
<form>
|
||||
<label name="message_type"/>
|
||||
<field name="message_type"/>
|
||||
<newline/>
|
||||
<label name="path"/>
|
||||
<field name="path" colspan="3"/>
|
||||
<label name="error_path"/>
|
||||
<field name="error_path" colspan="3"/>
|
||||
</form>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- The COPYRIGHT file at the top level of this repository contains the full
|
||||
copyright notices and license terms. -->
|
||||
<tree>
|
||||
<field name="message_type" expand="1"/>
|
||||
<field name="path" expand="1"/>
|
||||
<field name="error_path" expand="1"/>
|
||||
</tree>
|
Loading…
Reference in New Issue