Generate persistent classes


Generate Persistent Classes from OpenERP DB

file attachments


oscar_agreda wrote Sep 23, 2009 at 3:18 AM

Here is the Database Diagram for OpenERP,

garthhenderson wrote Sep 23, 2009 at 5:21 AM

I am having trouble with using the Persistent Classes Wizard to generate BOs from the PostgreSQL database.

Please see:

I would appreciate assistance from someone that has used ProgreSQL with the ORM Persistent Classes BO generator.

emiliodabdoub wrote Sep 23, 2009 at 6:23 AM

Garth: how many tables you have in your postgress database? I have 87, is that correct?

emiliodabdoub wrote Sep 23, 2009 at 7:30 AM

At last I could generate the classes after some hours struggling in the same problem as Garth.
In the end I dont know what resolved it, I did the following:
  1. downloaded Npgsql2.0.4-bin-ms.net3.5.zip
  2. added npgsql.dll and monodsecurity to GAC
  3. tried to use the wizard like 999 times
  4. groaned a lot
  5. copied the .dlls in the bin folder of the app
  6. tried to use the wizard like 999 times more
  7. groaned a lot more
  8. strudied the wizard template and foolishly tried to use the DevExpress.Xpo.Design.AddClassesFromDbWizardForCSharp with no luck
    9 groaned more aaaargh
  9. closed visual studio
    11 tried to generate the classes.. and bam!
    12 stomped my head against the wall
so, here are the classes, I noticed that some tables could not be selected, I dont know if they are system tables or what
some that I could not select:

So, whats next my good Garth? :)

oscar_agreda wrote Sep 23, 2009 at 9:38 AM

I did a "database fix" using the diagramer tool, and I get many more tables..

emiliodabdoub wrote Sep 23, 2009 at 10:40 AM

Well, I installed the sales and POS modules and I got 224 tables.

I think that we will need to sepparate the core tables from the additional modules tables

Attached is PersistentClasses2 which contains the 224 classes

oscar_agreda wrote Sep 23, 2009 at 5:16 PM

your are good Emilio !!!!

oscar_agreda wrote Sep 23, 2009 at 5:34 PM

I think the ultimate conversion openERP to XAF will be done by a small program (c#) that reads the PostgreSQL whole Database script and transform it to XAF classes.

In that way we will have the relationships generation as well, which is very important and we can generate a superb XAF class for each table, triggers, indexes, Store Procedures and relationships !

I am looking into that

garthhenderson wrote Sep 23, 2009 at 7:55 PM

Attached is OpenERP 092309.zip which is a new 9.2.5 project that uses an OpenERP SQL Database and runs with both Win and Web projects.

The SQL connection string is in App.config and web.config files.

We are ready to start converting BOs to XPCustomObjects w/GUIDs and painting GL screens.

I recommend breaking up the large Persistent Classes cs file into cs files that are based on similar functionality - like GL, OE, PO, AP, AR, etc.

oscar_agreda wrote Sep 24, 2009 at 3:35 AM

Here a Store Procedure for MS SQL that will generate all the XAF Persistent Classes from a Database at once.

I still need to
1-To generate all indexes and especially the relationships between tables
2-make it work on PostgreeSQL to use in openERP

any help is very welcome


oscar_agreda wrote Sep 24, 2009 at 3:47 AM


oscar_agreda wrote Sep 24, 2009 at 4:55 AM

here are the relationships..
I still need to obtain the keys

garthhenderson wrote Sep 24, 2009 at 10:36 PM

This issue has been completed. Please close