Raphael,

where can I get more info about base_external_ referentials? The magento_openerp_synchro module in addons-extras doesn't seem to use it.

If I understand correctly, with it I can have multiple "external_id" properties and use the standard XML loading process to load data, reference it using these external IDs. My need is to reference the object with a UUID and every system would translate it into the local ID. For instance, the res_partner[id=5] object would have a [uuid="unique_uuid"] attribute and serializations would dump it.

Since this uuid attribute is not a "business" concern, it would be more elegant if it's not implemented as a model "column".

CJ

Raphaël Valyi escreveu:
Hello guys,

This is a change/feature that affect mostly the magentoerpconnect users (they now have a list, see: https://launchpad.net/~magentoerpconnect-community ) for now, but I'm also sending that mail to the framework expert team so they gain awareness of generic the base_external_referentials module (as we believe it's very useful, we would rather like all ecommerce/other external systems to reuse it instead of adding their own foreign keys and mappings and not being multi-referential's) and what we just changed in it.

So we inform you that in last revision of the connector and dependent modules, especially base_external_referentials, we made an important change.

Indeed, instead of the new ir_model_data external_referential_id to be a normal foreign key field, it's now a computed field that infer the referential from the ir_model_data module name, provided the name is structured as follow:
extref.referential_name
in that case referential_name is used to match the referential by it's name. In any case, we keep storing the referential key using store=True to allow efficient SQL and easier backward compatibility.

Why we did that:
- ir_model_data has a unicity constraint upon its name: must have a unique name per module. This was incompatible with the multi-referential usage potentially!
- actually, the "module" field of ir_model_data already plays the role of the referential reference. In our case we just want to add a referential object with custom mapping and other properties, that's why we need an external_referential_id key, but in any case, it should not be redundant with the "module" key.
- doing this way has a better adherence to existing OpenERP import/export feature. Indeed, once those tools let you specify or read the module (I talk about that with Fabien and he said it was a possible evol), then you could specify / read  the external referential using built'in features only.

How to migrate:
I'll hopefully come back and post the SQL command, but basically you should update your ir_model_data of your entities that are sunch'ed with an external referential in order to have the module name matching:
extref.referential_name instead of the old "base_external_referentials_keep" dummy name.

PS: their is one more change I would like to make in base_external_referentials: rather than introducing the intermediary external_osv layer between osv.osv and business objects, I think it would be better to monkey patch osv.osv directly. Well it's not the worst monkey patching in the world as we would only add the external_osv feature and not change existing features. The advantage of extending osv.osv directly is that you wouldn't need anymore to have to code anything to have OpenERP managing the multi-references of some entity, you could just open your referential entity and add custom in/out external mappings as you like. However, that new change will luckily be transparent for migrations and updating the code will be trivial.

I think the framework expert list is the best place if you want to discuss the architecture of base_external_referentials.

Best regards,


Raphaël Valyi

_______________________________________________ Mailing list: https://launchpad.net/~openerp-expert-framework Post to : [email protected] Unsubscribe : https://launchpad.net/~openerp-expert-framework More help : https://help.launchpad.net/ListHelp




_______________________________________________
Mailing list: https://launchpad.net/~openerp-expert-framework
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-expert-framework
More help   : https://help.launchpad.net/ListHelp

Reply via email to