Community: Framework mailing list archives

expert-framework@mail.odoo.com

Re: Problem with inheriting standard field with type changing

by
Numa Extreme Systems, Gustavo Marino
- 12/12/2014 21:16:17
Denis:
I have made an investigation on changing the initialization order, trying to pospone it till all modules are loaded. Attached the patch I am using.

I have found the following problems:
  • There are many modules accessing models on init routines.
    In this case, if the model is not fully initialized you get SQL errors due to non existing fields or stored fields
  • There are some modules writing on models data on init routines.
    Same problem as before, but even worse because on write store fields are triggered.
In the patch, you will find a first section hack where the modules are load on a per module init til some problematic modules are loaded. Then, all the other modules are loaded and initialized at the very end.

It has still many bugs (it does not load demo data for example - not analyzed errors are found), but if you want it can be used as an exploration search for solutions

In an ideal environment, the obj.init method should be splitted on basic SQL structure adaptation and model initialization.
The structure update could be made before any init operation. But this proposal implies a lot of changes on existing modules, so it has almost null chances to be accepted by Odoo SA.

I dont have more time to follow this topic, but as already said, it seems to be a basic flaw.

Let us know if you find alternative solutions


Gustavo Adrian Marino

 

Mobile:  +54 911 5498 2515

Email: gamarino@numaes.com

Skype: gustavo.adrian.marino

 

<img border="0" width="213" height="94" src="cid:image001.jpg@01CC37F5.99B4CD20" alt="Descripción: Numa Logo V 1-0">



2014-12-12 1:52 GMT-03:00 Denis Karataev <dsk@t-technologies.com>:
Gustavo, thanks for your opinion.

Maybe anyone else has more information about this problem? I would appreciate. It's really pity to run migration script for inherited field values to move it from old database.

2014-12-11 17:37 GMT+03:00 Gustavo Marino <gamarino@numaes.com>:
It's look like a serious bug of the ORM.

Database structure update should be delayed till all modules are loaded. No workaround. For sure there are many other user cases where the intermediate update could be mortal.

Odoo SA should should provide an statement

Gustavo Adrian Marino

 

Mobile:  +54 911 5498 2515

Email: gamarino@numaes.com

Skype: gustavo.adrian.marino

 

<img border="0" width="213" height="94" src="cid:image001.jpg@01CC37F5.99B4CD20" alt="Descripción: Numa Logo V 1-0">



2014-12-11 8:27 GMT-03:00 Denis Karataev <dsk@t-technologies.com>:
Hi dear developers,

When we download and install new version of sources for v7 with new bugfixes, we have a problem with iherited fields.

For example we inherit the field "function" in res.partner model and we change type of the field from char to many2one to keep our records unique. I mean now we have model res.partner.function with unique values and users just select values from the dropdown list on the partner form. Ok good, it works, but when we install new sources and run database with "-u all", all values for the field become empty! I think it's because:

1)base module is updated first and in this module the field "function" has char type. OpenERP looks into database and there is another type of the field, and OpenERP changes the type to char.
2)our module is updated next and inherit the field "function" again and changes type to many2one.

It's my thoughts why we get this field empty after every update. Please could you give any recommendation how to avoid it, but to have "function" with many2one, not char?

Thank you!

--
Denis Karataev
CEO at Transparent Technologies



_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-framework-62
Post to: mailto:expert-framework@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe


_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-framework-62
Post to: mailto:expert-framework@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe




--
Denis Karataev
CEO at Transparent Technologies



_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-framework-62
Post to: mailto:expert-framework@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe