[Openerp-community] Track datamodel changes

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Openerp-community] Track datamodel changes

David Arnold - El Alemán
Hi People

I want to keep track on any db-changes realized on the database coloums during this last development phase until V8 stable is released.

I thought of something with grep and some magical statements (I surely would not quite understand). Does anyone have an idea how to accomplish this? Or is there any best practice arround?

​Thanks & kind regards

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Openerp-community] Track datamodel changes

David Arnold - El Alemán
git diff -S fields. f643660f169a26d8c2e71d7496c981bc2c171421

This somehow gives some weired output as it seems there has been added the windows line ending to many files (^M)

If there is no other way than suggested here [1], SA should thingk about how enforcing this, because the diff command is somewhat useless, if you want to extract customized information from history that way 


_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Openerp-community] Track datamodel changes

David Arnold - El Alemán
Maybe altering .gitattributes like suggested here:

Am I really the first person having this issue??

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Openerp-community] Track datamodel changes

David Arnold - El Alemán
I think here is the better place to adress it: https://github.com/odoo/odoo/issues/1640

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Openerp-community] Track datamodel changes

Grahame Jordan
In reply to this post by David Arnold - El Alemán
I use this little utility for find and grep.
eg: find . -type f | esc_special | xargs grep "fields\."
Maybe it should be called 'es' for typing sake.
Put it in /usr/local/bin/

Regards

Grahame Jordan



#include <stdio.h>
#include <string.h>

/**

Simple program to escape (i.e. prepend with a '\') characters that are BASH
special symbols that can occur in MSDOS filenames.

This is so lists of DOS files generated by "find" can be processed by
bash scripts.

Duncan Robertson 27 Nov 96

This is the command to compile:

cc -Wall -O2 -o esc_special esc_special.c

**/

/* This is the list of special characters we need to escape */
char *specials = "'\"\\()&~ ";


int main(int argc, char *argv[])
{
   int the_char;

   while ((the_char = getchar()) != EOF)
   {
      if (strchr(specials,the_char) != (char *)NULL)
      {
         putchar('\\');
      }
      putchar(the_char);
   }
   return (0);
}


On 07/08/14 08:25, David Arnold - El Alemán wrote:
git diff -S fields. f643660f169a26d8c2e71d7496c981bc2c171421

This somehow gives some weired output as it seems there has been added the windows line ending to many files (^M)

If there is no other way than suggested here [1], SA should thingk about how enforcing this, because the diff command is somewhat useless, if you want to extract customized information from history that way 



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


--
Glass Expansion
15 Batman Street
West Melbourne
Victoria 3003
AUSTRALIA
T: +61 3 9320 1111
F: +61 3 9320 1112
www.geicp.com


Click here to check out our new TruFlo Sample Monitor


404 Not Found

Not Found

The requested URL /site/dbimages/TruFlo.jpg was not found on this server.


Apache/2.2.22 (Debian) Server at geicp.com Port 80

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Openerp-community] Track datamodel changes

Sébastien ALIX
In reply to this post by David Arnold - El Alemán
Hi,

Another way is to extract the schema with RPC (with a tool like
OERPLib). I just wrote a POC script here:
https://gist.github.com/sebalix/8cb0acc2cff419f4529e

First, install OERPLib:

        $ pip install oerplib

Then edit the header data of the script for connection data to Odoo.
Generate the reference scheme:

        $ ./dump_schema.py > s1.json

Make another dump later:

        $ ./dump_schema.py > s2.json

And compare them:

        $ ./dump_schema.py s1.json s2.json

The output will look like this:

> ---- ADDED ----
>     - product.attribute.renamed
>
> ---- REMOVED ----
>     - product.attribute
>
> ---- MODIFIED ----
>     - account.move.line.reconcile.select
>         A  account_id2
>         R  account_id
>         M  create_uid
>             M  string (u'Created by2' => u'Created by')
>     - email_template.preview
>         M  sub_object
>             M  store (False => True)

Regards,



Le 06/08/2014 21:16, David Arnold - El Alemán a écrit :

> *Hi People*
> *
> *
> I want to keep track on any db-changes realized on the database coloums
> during this last development phase until V8 stable is released.
>
> I thought of something with grep and some magical statements (I surely
> would not quite understand). Does anyone have an idea how to accomplish
> this? Or is there any best practice arround?
>
> *
> ​Thanks & kind regards
> *
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openerp-community
> Post to     : [hidden email]
> Unsubscribe : https://launchpad.net/~openerp-community
> More help   : https://help.launchpad.net/ListHelp
>

--
Sébastien ALIX
ABF Osiell
Immeuble Oméga
Rue Jean-Marie David
35740 PACÉ, FRANCE
Tél: 09 72 36 91 08
Site: http://www.osiell.com

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Openerp-community] Track datamodel changes

Jean Sébastien HEDERER
Very good. But it needs to apply changes to obtain s2.json. I think question was to track datamodel changes in source code.
Your method is very interesting
 
 
----------------message d'origine-----------------
De: Sébastien Alix [[hidden email]  ]
A: [hidden email]  
Date: Thu, 07 Aug 2014 11:21:05 +0200
-------------------------------------------------
 
 

> Hi,
>
> Another way is to extract the schema with RPC (with a tool like
> OERPLib). I just wrote a POC script here:
> https://gist.github.com/sebalix/8cb0acc2cff419f4529e
>
> First, install OERPLib:
>
> $ pip install oerplib
>
> Then edit the header data of the script for connection data to Odoo.
> Generate the reference scheme:
>
> $ ./dump_schema.py > s1.json
>
> Make another dump later:
>
> $ ./dump_schema.py > s2.json
>
> And compare them:
>
> $ ./dump_schema.py s1.json s2.json
>
> The output will look like this:
>
>> ---- ADDED ----
>>     - product.attribute.renamed
>>
>> ---- REMOVED ----
>>     - product.attribute
>>
>> ---- MODIFIED ----
>>     - account.move.line.reconcile.select
>>         A  account_id2
>>         R  account_id
>>         M  create_uid
>>             M  string (u'Created by2' => u'Created by')
>>     - email_template.preview
>>         M  sub_object
>>             M  store (False => True)
>
> Regards,
>
>
>
> Le 06/08/2014 21:16, David Arnold - El Alemán a écrit :
>> *Hi People*
>> *
>> *
>> I want to keep track on any db-changes realized on the database coloums
>> during this last development phase until V8 stable is released.
>>
>> I thought of something with grep and some magical statements (I surely
>> would not quite understand). Does anyone have an idea how to accomplish
>> this? Or is there any best practice arround?
>>
>> *
>> Thanks & kind regards
>> *
>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~openerp-community
>> Post to     : [hidden email]  
>> Unsubscribe : https://launchpad.net/~openerp-community
>> More help   : https://help.launchpad.net/ListHelp
>>
>
> --
> Sébastien ALIX
> ABF Osiell
> Immeuble Oméga
> Rue Jean-Marie David
> 35740 PACÉ, FRANCE
> Tél: 09 72 36 91 08
> Site: http://www.osiell.com
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openerp-community
> Post to     : [hidden email]  
> Unsubscribe : https://launchpad.net/~openerp-community
> More help   : https://help.launchpad.net/ListHelp
>



_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Openerp-community] Track datamodel changes

Alexandre Fayolle - camptocamp
In reply to this post by David Arnold - El Alemán
On 06/08/2014 21:16, David Arnold - El Alemán wrote:
Hi People

I want to keep track on any db-changes realized on the database coloums during this last development phase until V8 stable is released.

I thought of something with grep and some magical statements (I surely would not quite understand). Does anyone have an idea how to accomplish this? Or is there any best practice arround?

Hi David,

There are tools for this in the OpenUpgrade project.

-- 
Alexandre Fayolle
Chef de Projet
Tel : + 33 (0)4 79 26 57 94

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac Cedex
http://www.camptocamp.com

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Openerp-community] Track datamodel changes

Sébastien ALIX
In reply to this post by Jean Sébastien HEDERER
Le 07/08/2014 12:33, Jean Sébastien HEDERER ASPerience a écrit :
> Very good. But it needs to apply changes to obtain s2.json. I think question was to track datamodel changes in source code.
> Your method is very interesting
>

With the previous script, you just have to install all modules on an
instance on a given Git commit ID. When the 8.0 is release, update this
instance, re-run the script to extract the new scheme, and compare it to
the previous one.
But I agree that this way we don't know where the changes happen (in
which module, which file...), it's just an overview of the changes at
the application/ORM level. But it allows the Odoo team to make some
refactoring without changing the scheme, like migrating to the new API
v8 (in account and event modules for instance), or reformat/reindent the
code, and we don't need to care about that.

Regards,


--
Sébastien ALIX
ABF Osiell
Site: http://www.osiell.com

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Openerp-community] Track datamodel changes

David Arnold - El Alemán
Cool, thanks for all the input!

Sebastien, your approach seems very useful, and has even extended use in other situations...
Alexandre, thanks, I'll have a look at it.
Grahame, if I relate the little I understand with my question, I would need two files to compare, I would prefer however the diff built in grep (SA fixing the EOL issue)

However, I think git already provides the tools for it onboard (git diff -S [string] or git diff -G [grep]). It might save time over initiallizing a DB with all modules. The problem here is, that the EOL in the core changes occasionally when developing is done across Windows or Unix machines (missing settings in .gitattribute), I think anyhow SA should fix this.

Ragards

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Openerp-community] Track datamodel changes

David Arnold - El Alemán
Hi

I want to extend this thread, as the actuall issue has been adressed accordingly on github.com:

As we work a lot with csv files and those are ugly for a standard diff, maybe can someone help me to include a csvdiff parser into the .gitattributes

If we can succeed in this, it would be a must have for SA and OCA, too - i think.

Best regards

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Openerp-community] Track datamodel changes

David Arnold - El Alemán
Hi

Seems, there are great solutions available:


Enjoy!

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Openerp-community] Track datamodel changes

Nhomar Hernández
In reply to this post by David Arnold - El Alemán

2014-08-10 3:20 GMT-04:30 David Arnold - El Alemán <[hidden email]>:
If we can succeed in this, it would be a must have for SA and OCA, too - i think.

Ca you please make the change (pick the OCA repository you think is better) and make the PR , in that way we can talk with the code in front of us.

I don't see any problem to include this featur it looks really nice but I can't see the practical and non practical implications reading exactly the change you will make I can understand better ... regards.


--
--------------------
Saludos Cordiales

Nhomar G. Hernandez M.
+58-414-4110269
Skype: nhomar00
Web-Blog: http://geronimo.com.ve
Servicios IT: http://vauxoo.com
Linux-Counter: 467724
Correos:
[hidden email]
[hidden email]
twitter @nhomar

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : [hidden email]
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp
Loading...