init_xml also updates security/ir.model.access.csv

Bug #510668 reported by Shah Japan
28
This bug affects 7 people
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Invalid
Medium
OpenERP's Framework R&D

Bug Description

if we provide a security/ir.model.access.csv file for access rights on init_xml instead update_xml,
it also updates the csv though it was shifted to init_xml.....

Tags: maintenance
Changed in openobject-server:
status: New → Invalid
Changed in openobject-server:
status: Invalid → Confirmed
importance: Undecided → Medium
assignee: nobody → OpenERP's Framework R&D (openerp-dev-framework)
tags: added: maintenance
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

This is not valid in 6.0, please explain better if you really think this is a bug.
BTW in 6.0 you should be using the "data" section instead of "init_xml" or "update_xml", and both work the same.

Changed in openobject-server:
status: Confirmed → Invalid
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

What I meant is that _init_xml and _update_xml are kind of deprecated in 6.0, and replace by the simpler 'data' section in the __openerp__.py module descriptor.

Revision history for this message
Martin Collins (mkc-steadfast) wrote :

Where is this documented?
And how does it solve the problem?

They "both work the same" _is_ the problem.

If you load a datafile in the "init_xml" (or "data"),
then you change it in the system,
then you update your module:
the init data is reloaded and your changes are overwritten.

I have broken my production system this way.
Fortunately, I knew immediately what had happened and was able to fix it quickly.
Someone who has made many changes over a long period may not be so lucky.

noupdate=True is hard-coded for CSV files but has no effect.
Reports are that setting it for XML files also has no effect.
Only running with --import-partial prevents this.

"init_xml" should never overwrite existing data. Only "update_xml" should do this (and one should only use it for views and the like, not data). "init_xml" should not even try to load on updates. Combing them into one "data" is the opposite of a fix.

Revision history for this message
asdferfasdfasp9f7as98df (benoit.m-deactivatedaccount) wrote :

TL;DR How do we load CSV files at --init only?

Sorry to step into a dead conversation but the question raised by this bug report has not been answered and I'm having this issue as well.

I'm running a fairly fresh version (ie. a couple of days) of OpenERP Server 6.1.

I would like (just like the original op) to ship CSV data with a module but that CSV data should not be updated (-u or --update) and should only be loaded at install time (-i or --init).

Neither update_xml, init_xml or data work as advertised either by their name or by the documentation[1]. Using noupdate="1" is not applicable for CSV files and would in my opinion only be a work-around for a what I would call a defect of the software.

I think the problem is fairly clear and does not necessitate a proo-of-concept module but do let me know if it does.

Thanks in advance.

[1] http://doc.openerp.com/v6.1/developer/03_modules_1.html#openerp-module-descriptor-file-openerp-py

Revision history for this message
Martin Collins (mkc-steadfast) wrote :

It's not dead, it's just resting...
This and related issues have been rumbling on for years:
https://bugs.launchpad.net/openobject-server/+bug/397741
https://bugs.launchpad.net/openobject-server/+bug/1023615
https://bugs.launchpad.net/openobject-server/+bug/1024114

For xml files a hitherto secret 'solution' is to add forcecreate="False" to every record you don't want updated. Without this deleted records will be recreated even with noupdate="True".

For csv files I just comment out all the files I don't want updating in __openerp__.py after the first install. This is obviously not satisfactory for modules that other people might use.

The official position seems to be that you should make a separate module containing all your post-installation modifications using the module-recorder so you can reapply them after an update.
This requires that you:
1) remember to make a new module before every update
2) remember which objects you have modified, or know which ones will be overwritten
3) are smart enough to figure this out for yourself before the first time you update or you're screwed.

On the upside it means that __openerp__.py can be simplified. Big win!

Revision history for this message
Gustavo Adrian Marino (gamarino) wrote : Re: [Bug 510668] Re: init_xml also updates security/ir.model.access.csv

Benoit:
Please refer also to Bug #1024114, same concerns as here
*
*
2012/8/1 Benoit Myard <email address hidden>

> TL;DR How do we load CSV files at --init only?
>
> Sorry to step into a dead conversation but the question raised by this
> bug report has not been answered and I'm having this issue as well.
>
> I'm running a fairly fresh version (ie. a couple of days) of OpenERP
> Server 6.1.
>
> I would like (just like the original op) to ship CSV data with a module
> but that CSV data should not be updated (-u or --update) and should only
> be loaded at install time (-i or --init).
>
> Neither update_xml, init_xml or data work as advertised either by their
> name or by the documentation[1]. Using noupdate="1" is not applicable
> for CSV files and would in my opinion only be a work-around for a what I
> would call a defect of the software.
>
> I think the problem is fairly clear and does not necessitate a proo-of-
> concept module but do let me know if it does.
>
> Thanks in advance.
>
> [1] http://doc.openerp.com/v6.1/developer/03_modules_1.html#openerp-
> module-descriptor-file-openerp-py
>
> --
> You received this bug notification because you are subscribed to OpenERP
> Server.
> https://bugs.launchpad.net/bugs/510668
>
> Title:
> init_xml also updates security/ir.model.access.csv
>
> Status in OpenERP Server:
> Invalid
>
> Bug description:
> if we provide a security/ir.model.access.csv file for access rights on
> init_xml instead update_xml,
> it also updates the csv though it was shifted to init_xml.....
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/openobject-server/+bug/510668/+subscriptions
>

--

Gustavo Adrian Marino

Mobile: +54 911 5498 2515

Email: <email address hidden>

Skype: gustavo.adrian.marino

Revision history for this message
Gustavo Adrian Marino (gamarino) wrote :

Martin:
Use the patch on 1024114 and everthing will be on place again. (In fact, it
is just a one line modification!)

For sure it is not related to difficulty to be implemented, just a
religious position

2012/8/1 Martin Collins <email address hidden>

> It's not dead, it's just resting...
> This and related issues have been rumbling on for years:
> https://bugs.launchpad.net/openobject-server/+bug/397741
> https://bugs.launchpad.net/openobject-server/+bug/1023615
> https://bugs.launchpad.net/openobject-server/+bug/1024114
>
> For xml files a hitherto secret 'solution' is to add forcecreate="False"
> to every record you don't want updated. Without this deleted records
> will be recreated even with noupdate="True".
>
> For csv files I just comment out all the files I don't want updating in
> __openerp__.py after the first install. This is obviously not
> satisfactory for modules that other people might use.
>
> The official position seems to be that you should make a separate module
> containing all your post-installation modifications using the
> module-recorder so you can reapply them after an update.
> This requires that you:
> 1) remember to make a new module before every update
> 2) remember which objects you have modified, or know which ones will be
> overwritten
> 3) are smart enough to figure this out for yourself before the first time
> you update or you're screwed.
>
> On the upside it means that __openerp__.py can be simplified. Big win!
>
> --
> You received this bug notification because you are subscribed to OpenERP
> Server.
> https://bugs.launchpad.net/bugs/510668
>
> Title:
> init_xml also updates security/ir.model.access.csv
>
> Status in OpenERP Server:
> Invalid
>
> Bug description:
> if we provide a security/ir.model.access.csv file for access rights on
> init_xml instead update_xml,
> it also updates the csv though it was shifted to init_xml.....
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/openobject-server/+bug/510668/+subscriptions
>

--

Gustavo Adrian Marino

Mobile: +54 911 5498 2515

Email: <email address hidden>

Skype: gustavo.adrian.marino

Revision history for this message
Martin Collins (mkc-steadfast) wrote :

Gustavo, that patch just sets noupdate=True for csv files in the update_xml section.
The problem we have is that noupdate=True does not work, regardless of section.

Revision history for this message
Gustavo Adrian Marino (gamarino) wrote :
  • diff.001 Edit (1.1 KiB, application/octet-stream; name="diff.001")

Martin:;
There is the patch for the noupdate. Sorry, no good testing before.
This one has been tested creating a new db and changing persmisions by
hand. A module update does not destroy changes
Any comments is welcome

2012/8/1 Martin Collins <email address hidden>

> Gustavo, that patch just sets noupdate=True for csv files in the
> update_xml section.
> The problem we have is that noupdate=True does not work, regardless of
> section.
>
> --
> You received this bug notification because you are subscribed to OpenERP
> Server.
> https://bugs.launchpad.net/bugs/510668
>
> Title:
> init_xml also updates security/ir.model.access.csv
>
> Status in OpenERP Server:
> Invalid
>
> Bug description:
> if we provide a security/ir.model.access.csv file for access rights on
> init_xml instead update_xml,
> it also updates the csv though it was shifted to init_xml.....
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/openobject-server/+bug/510668/+subscriptions
>

--

Gustavo Adrian Marino

Mobile: +54 911 5498 2515

Email: <email address hidden>

Skype: gustavo.adrian.marino

Revision history for this message
asdferfasdfasp9f7as98df (benoit.m-deactivatedaccount) wrote :

Dead or resting, the net result is that there's no good to solution to this issue. I think finding a work-around (through a patch or manually commenting offending lines) is a non-issue for the technical among of us (and by the looks of it, all parties involved in the bug report are technical).

Although we can all patch our installations, it's also something we wish to avoid and do avoid whenever a solution exists. I'd like to have someone take an official position on the issue and give us a clear answer. Surely, OpenERP ought to provide a way to create data at install time and let users modify it without the fear of loosing their modifications whenever the module is updated (think of default configuration here).

So, any chance of seeing those patches land in the official code?

Revision history for this message
Martin Collins (mkc-steadfast) wrote :

I will try this patch when I can. It looks more likely than the last one.

Both Fabien and Olivier marked this bug invalid. Their changes to __openerp__.py show they really think there is no problem. These patches will not make it into official code.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.