added EDI_buyer

This commit is contained in:
Marcos Sabater 2019-09-04 17:31:32 +02:00
parent 22cb41f650
commit 885b40b4ff
7 changed files with 207 additions and 80 deletions

View File

@ -17,6 +17,8 @@ class Configuration(
fields.Many2One('ir.sequence', 'Electronic Document Sequence',
required=True))
export_path = fields.Char('Export Path')
import_path = fields.Char('Import Path')
error_path = fields.Char('Error Path')
@classmethod
def multivalue_model(cls, field):

View File

@ -62,7 +62,6 @@ class EdocumentMessage(ModelView, ModelSQL):
class EdocumentMixin():
message = fields.Many2One('edocument.message', 'Message')
@classmethod
@ -79,11 +78,17 @@ class EdocumentMixin():
@classmethod
def _source_uri(cls):
pass
pool = Pool()
Configuration = pool.get('edocument.configuration')
config = Configuration(0)
return config.import_path
@classmethod
def _error_uri(cls):
pass
pool = Pool()
Configuration = pool.get('edocument.configuration')
config = Configuration(0)
return config.error_path
@classmethod
def _template(cls):
@ -96,8 +101,8 @@ class EdocumentMixin():
return EdocumentFileManager()
@classmethod
def _create_objects_from_edi(cls, source_uri, error_uri, template=None,
target_model=None):
def _create_objects_from_edi(
cls, source_uri, error_uri, template=None, target_model=None):
"""
Get objects from edi files
"""
@ -141,8 +146,7 @@ class EdocumentMixin():
results = cls._create_objects_from_edi(
cls._source_uri(),
cls._error_uri(),
target_model=target_model,
)
target_model=target_model)
cls.postprocess(results)
return results
@ -165,9 +169,9 @@ class EdocumentFileManager():
@classmethod
def _handle_errors(cls, fname, errors, error_uri):
error_fname = os.path.join(error_uri, 'error_{}.EDI'.format(
os.path.splitext(os.path.basename(fname))[0]
))
error_fname = os.path.join(
error_uri, 'error_{}.EDI'.format(
os.path.splitext(os.path.basename(fname))[0]))
with open(error_fname, 'w') as fp:
fp.write('\n'.join(errors))

View File

@ -2,6 +2,82 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "error:edocument.template:"
msgid "Combination of message type and party must be unique."
msgstr "La combinación de tipo de mensaje y tercero debe ser única."
msgctxt "field:edocument.configuration,create_date:"
msgid "Create Date"
msgstr "Fecha de creación"
msgctxt "field:edocument.configuration,create_uid:"
msgid "Create User"
msgstr "Usuario de creación"
msgctxt "field:edocument.configuration,edocument_sequence:"
msgid "Electronic Document Sequence"
msgstr "Secuencia Documentación Electrónica"
msgctxt "field:edocument.configuration,error_path:"
msgid "Error Path"
msgstr "Ruta Errores"
msgctxt "field:edocument.configuration,export_path:"
msgid "Export Path"
msgstr "Ruta Exportación"
msgctxt "field:edocument.configuration,id:"
msgid "ID"
msgstr "Identificador"
msgctxt "field:edocument.configuration,import_path:"
msgid "Import Path"
msgstr "Ruta Importación"
msgctxt "field:edocument.configuration,rec_name:"
msgid "Record Name"
msgstr "Nombre registro"
msgctxt "field:edocument.configuration,write_date:"
msgid "Write Date"
msgstr "Fecha modificación"
msgctxt "field:edocument.configuration,write_uid:"
msgid "Write User"
msgstr "Usuario que escribe."
msgctxt "field:edocument.configuration.sequence,company:"
msgid "Company"
msgstr "Empresa"
msgctxt "field:edocument.configuration.sequence,create_date:"
msgid "Create Date"
msgstr "Fecha de creación"
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"
msgctxt "field:edocument.configuration.sequence,rec_name:"
msgid "Record Name"
msgstr "Nombre registro"
msgctxt "field:edocument.configuration.sequence,write_date:"
msgid "Write Date"
msgstr "Fecha modificación"
msgctxt "field:edocument.configuration.sequence,write_uid:"
msgid "Write User"
msgstr "Usuario que escribe."
msgctxt "field:edocument.message,code:"
msgid "Code"
msgstr "Código"
@ -38,7 +114,42 @@ msgctxt "field:edocument.message,write_uid:"
msgid "Write User"
msgstr "Usuario que escribe."
#, fuzzy
msgctxt "field:edocument.template,create_date:"
msgid "Create Date"
msgstr "Fecha de creación"
msgctxt "field:edocument.template,create_uid:"
msgid "Create User"
msgstr "Usuario de creación"
msgctxt "field:edocument.template,id:"
msgid "ID"
msgstr "Identificador"
msgctxt "field:edocument.template,message_type:"
msgid "Document"
msgstr "Documento"
msgctxt "field:edocument.template,party:"
msgid "Party"
msgstr "Terceros"
msgctxt "field:edocument.template,rec_name:"
msgid "Record Name"
msgstr "Nombre registro"
msgctxt "field:edocument.template,template:"
msgid "Template"
msgstr "Plantilla"
msgctxt "field:edocument.template,write_date:"
msgid "Write Date"
msgstr "Fecha modificación"
msgctxt "field:edocument.template,write_uid:"
msgid "Write User"
msgstr "Usuario que escribe."
msgctxt "field:incoterm.rule,EDI_code:"
msgid "EDI Code"
msgstr "Código EDI"
@ -59,12 +170,10 @@ msgctxt "field:party.party,edi_release_number:"
msgid "Release Number"
msgstr "Número Versión"
#, fuzzy
msgctxt "field:product.cross_reference,EDI_code:"
msgid "EAN Code"
msgstr "Código EAN"
#, fuzzy
msgctxt "field:product.product,EDI_code:"
msgid "EDI Code"
msgstr "Código EDI"
@ -73,62 +182,38 @@ 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 ""
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 ""
#, fuzzy
msgctxt "field:stock.configuration.edi_output_path,company:"
msgid "Company"
msgstr "Empresa"
#, fuzzy
msgctxt "field:stock.configuration.edi_output_path,create_date:"
msgid "Create Date"
msgstr "Fecha de creación"
#, fuzzy
msgctxt "field:stock.configuration.edi_output_path,create_uid:"
msgid "Create User"
msgstr "Usuario de creación"
#, fuzzy
msgctxt "field:stock.configuration.edi_output_path,id:"
msgid "ID"
msgstr "Identificador"
#, fuzzy
msgctxt "field:stock.configuration.edi_output_path,rec_name:"
msgid "Record Name"
msgstr "Nombre registro"
#, fuzzy
msgctxt "field:stock.configuration.edi_output_path,write_date:"
msgid "Write Date"
msgstr "Fecha modificación"
#, fuzzy
msgctxt "field:stock.configuration.edi_output_path,write_uid:"
msgid "Write User"
msgstr "Usuario que escribe."
#, fuzzy
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"
msgctxt "model:edocument.configuration.sequence,name:"
msgid "Edocument Configuration Sequence"
msgstr "Secuencia de Documentación Electrónica"
msgctxt "model:edocument.message,name:"
msgid "EDIFACT message"
msgstr "Mensaje EDIFACT"
msgctxt "model:edocument.template,name:"
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"
msgctxt "model:ir.action,name:act_edocument_template_form"
msgid "Edocument Templates"
msgstr "Plantillas de Documentación Electrónica"
msgctxt "model:ir.sequence,name:sequence_edocument"
msgid "Electronic Document sequence"
msgstr "Secuencia Documentación Electrónica"
@ -137,21 +222,49 @@ msgctxt "model:ir.sequence.type,name:sequence_type_edocument"
msgid "Electronic Document"
msgstr "Documentación Electrónica"
msgctxt "model:stock.configuration.edi_output_path,name:"
msgid "Stock Configuration EDI Output Path"
msgstr ""
msgctxt "model:ir.ui.menu,name:menu_configuration"
msgid "Configuration"
msgstr "Configuración"
msgctxt "model:ir.ui.menu,name:menu_edocument"
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"
msgctxt "model:ir.ui.menu,name:menu_edocument_template"
msgid "Edocument Templates"
msgstr "Plantillas de Documentación Electrónica"
msgctxt "selection:edocument.template,message_type:"
msgid "DESADV"
msgstr "DESADV"
msgctxt "selection:edocument.template,message_type:"
msgid "INVOIC"
msgstr "INVOIC"
msgctxt "selection:party.identifier,type:"
msgid "EDI Payer"
msgstr "EDI Pagador"
msgctxt "selection:party.identifier,type:"
msgid "EDI Receiver"
msgstr ""
msgstr "EDI Receptor"
msgctxt "selection:party.identifier,type:"
msgid "EDI Buyer"
msgstr "EDI Comprador"
msgctxt "selection:party.identifier,type:"
msgid "EDI Sender"
msgstr ""
msgstr "EDI Emisor"
msgctxt "selection:party.identifier,type:"
msgid "EDI Supplier"
msgstr ""
msgstr "EDI Proveedor"
msgctxt "selection:party.party,edi_assigned_code:"
msgid " "
@ -159,43 +272,43 @@ msgstr ""
msgctxt "selection:party.party,edi_assigned_code:"
msgid "EAN001"
msgstr ""
msgstr "EAN001"
msgctxt "selection:party.party,edi_assigned_code:"
msgid "EAN002"
msgstr ""
msgstr "EAN002"
msgctxt "selection:party.party,edi_assigned_code:"
msgid "EAN003"
msgstr ""
msgstr "EAN003"
msgctxt "selection:party.party,edi_assigned_code:"
msgid "EAN004"
msgstr ""
msgstr "EAN004"
msgctxt "selection:party.party,edi_assigned_code:"
msgid "EAN005"
msgstr ""
msgstr "EAN005"
msgctxt "selection:party.party,edi_assigned_code:"
msgid "EAN006"
msgstr ""
msgstr "EAN006"
msgctxt "selection:party.party,edi_assigned_code:"
msgid "EAN007"
msgstr ""
msgstr "EAN007"
msgctxt "selection:party.party,edi_assigned_code:"
msgid "EAN008"
msgstr ""
msgstr "EAN008"
msgctxt "selection:party.party,edi_assigned_code:"
msgid "EAN009"
msgstr ""
msgstr "EAN009"
msgctxt "selection:party.party,edi_assigned_code:"
msgid "EAN010"
msgstr ""
msgstr "EAN010"
msgctxt "selection:party.party,edi_release_number:"
msgid " "
@ -203,8 +316,12 @@ msgstr ""
msgctxt "selection:party.party,edi_release_number:"
msgid "01B"
msgstr ""
msgstr "01B"
msgctxt "selection:party.party,edi_release_number:"
msgid "93A"
msgstr "93A"
msgctxt "selection:party.party,edi_release_number:"
msgid "96A"
msgstr ""
msgstr "96A"

View File

@ -41,4 +41,5 @@ class PartyIdentifier(metaclass=PoolMeta):
('EDI_sender', 'EDI Sender'),
('EDI_receiver', 'EDI Receiver'),
('EDI_supplier', 'EDI Supplier'),
('EDI_payer', 'EDI Payer')])
('EDI_payer', 'EDI Payer'),
('EDI_buyer', 'EDI Buyer')])

View File

@ -23,7 +23,6 @@ def read(fname):
'r', encoding='utf-8').read()
def get_require_version(name):
if minor_version % 2:
require = '%s >= %s.%s.dev0, < %s.%s'
@ -34,7 +33,6 @@ def get_require_version(name):
return require
config = ConfigParser()
config.read_file(open('tryton.cfg'))
info = dict(config.items('tryton'))
@ -83,7 +81,7 @@ dependency_links = {
'series': series,
},
'party_edi':
'hg+https://bitbucket.org/nantic/'
'hg+https://bitbucket.org/datalife_sco/'
'trytond-party_edi@%(branch)s'
'#egg=nantic_party_edi-%(series)s' % {
'branch': branch,
@ -91,7 +89,7 @@ dependency_links = {
},
}
requires = []
requires = ['oyaml']
for dep in info.get('depends', []):
if not re.match(r'(ir|res)(\W|$)', dep):
prefix = MODULE2PREFIX.get(dep, 'trytond')

View File

@ -16,3 +16,4 @@ xml:
stock.xml
incoterm.xml
edocument.xml
party.xml

View File

@ -4,6 +4,10 @@
<form>
<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>