For some referential data there is sometimes a source that can be used as an authoritative origin (it could be a website, another database or even a file stored somewhere).
Tryton should have a mechanism to allow users to use it when creating a new record.
Our proposition is to use something that would look like the auto-completion drop-down that people can find currently below the
This drop-down could be completed with results from the a query to the different sources for this specific model. Something like:
(I suck at gimp )
Once selecting a party from another source, the
default_get is called with the
external_source context to fill the new form.
Of course we want this process to be also available when the user click directly on the “Create” button for a model that supports this operation. But in this case the process should be a bit different as selecting a Tryton record would go to this record while selecting a record from another source would open the form with the data from the source.
This process could be used to create on request some data that we currently create from XML files (countries and currencies).
The implementation would rely on the following mixin class:
get_external_sources(name: str) → list
Query the external data source and return a list of dictionaries with the keys
Model.default_getto use contextual key
The modules providing new data sources will use the Tryton inheritance to implement both method for their own data source. How they do it is left to the implementer.
The inheritance of the mixin class will be transmitted to the client so that he knows which process should be launched when clicking on the “New” button.
The existence of a data source for some records could be used to trigger an update of the actual data. This will at least require to store the
id. We can expect people to always agree with the authoritative source and thus displaying the changes is probably not necessary.