EDI/Integration API Proposal

I would like to propose, and volunteer to participate in the development of, a general purpose Integration API for Tryton.

I’ve spent a few years deconstructing a proprietary any-to-any transformation application and have some ideas how to implement it in python and integrate it in Tryton.
At an overview level - I envision an interface that can accept any transaction-type/standard (X12, EDIFACT, UNCEFACT, UBL, cXML, customized XML, JSON, Flatfile Delimited and Fixed) for which a schema has been created and registered with the parser.
My experience has shown that when a generic document is able to be matched against such a schema, then it can be parsed and the data extracted or transformed into other formats or loaded directly into models/tables.

To perform a transformation, these key things are needed
What standard/document-type is it? (X12, EDIFACT, UBL)
That allows the document-type (ORDERS, INVOIC), from & to parties and version to be used to match the specific document instance to a specific transformation class.

I’d like to see a HTTP listener as a generic document startpoint and folder & sFTP pickups also available for getting these files into the parsing engine.

This is a rough draft and only the skeleton of a description - much more to follow from a specification standpoint - but hopefully this is a good starting point for community discussion.

I’ve used the timesheet module for a sample of basic user/key Bearer authorization and am beginning the process of creating the transformation_profile model & views for holding the schema/from/to/version requirements mentioned above. I’ll update the community as I work through each of my POC milestones.

I’ve created a module using cookie-cutter called edi_test.
Below is the model for edi_test.message_in_profile within the edi_test.py file.
What do I need in the XML for the tree-view and edit-view files? I’m just not getting the gist from the documentation - samples would be very helpful.

from trytond.model import ModelView, ModelSQL, fields

list of all classes in the file

all = [‘Message_In_Profile’]

class Message_In_Profile(ModelSQL, ModelView):
# description (mandatory on first declaration)

# Internal class name. Always used as a reference inside Tryton
# default: '<module_name>.<class_name>' on Tryton
# becomes '<module_name>_<class_name>' in the database
__name__ = 'edi_test.message_in_profile'

description = fields.Char('Description', required=True)	# Display name of the profile
standard = fields.Char('Standard', required=True)		# X12, EDIFACT, UNCEFACT, UBL, cXML, ebXML
from_id = fields.Char('From_ID')				# ID of Originator
to_id = fields.Char('To_ID')					# ID of Recipient
message_group = fields.Char('Message_Group', required=True)	# PO, ORDERS
version = fields.Char('Version')				# 004010, D96A
map = fields.Char('Map', required=True)			# Transformation Map
destination = fields.Char('Destination')			# Transformation destination

Can anyone help me understand the view mechanism? I’m assuming the view files populate the menu items. Here is the timesheet module. What entries correspond to which items in the graphic?


I have attempted to duplicate the training/opportunity model and views, but am getting an error when attempting to activate the module with trytond-admin -u

I’m just not sure how much of the logs to post here for help.
Here’s the error I’m getting, if anyone has suggestions to troubleshoot - or has samples for models/views to share, I would appreciate it.

trytond.ir.ui.view.XMLError: (‘UserError’, (‘Invalid XML for view “edi_test.message_in_profile”.’, ‘:4:0:ERROR:RELAXNGV:RELAXNG_ERR_INVALIDATTR: Invalid attribute string for element tree’, None))

This is an error from relaxedNG (this is a dtd checker for the file xml file) in question:

  • for view “edi_test.message_in_profile”
    This means there is an error in the view with id message_in_profile (non in the view folder, but the xml file in root directory.)
  • RELAXNG_ERR_INVALIDATTR: Invalid attribute string for element tree
    this can indicate that you create an invalid attribute in the tag tree

If you want more information you can add all the -v(more v means more verbose).

You should remove the string attribute of the form and tree views you defined on your module.

Probably this is because the training repo is not updated to latest series, as this attribute was removed on series 4.2 (IIRC)

The items on the graphis are created by a menuitem, which is used to create an entry on the menu. This menuitem has a related action (set with the action attribute) which is used to indicate the action that should be executed when clicking the menu.

Hope it helps!

Removing the string attribute from the form & tree xml files in the view folder fixed it.
I now see the module & model in the sao UI

Thank you Sergi!