ER Diagram for ERPNEXT or Data Dictionary to assist in understanding and contributing to development

1,289 views
Skip to first unread message

Erran Botha

unread,
May 8, 2013, 7:46:31 AM5/8/13
to ERPNext Developer Forum, er...@sysv.com
Hello Guys,

I see a great diagram here http://erpnext.com/files/erpnext_links.html
and it is pretty and the relationships are layed out in the code:

eg:
// define relationships - focus on "source" and "target"
// "source_type" and "target_type" is extra data used to selectively
truncate data set
var _data = [
{"source": "Account", "target_type": "Master", "target": "Cost
Center", "source_type": "Master"},
{"source": "Account", "target_type": null, "target": "GL Entry",
"source_type": "Master"},
{"source": "Account", "target_type": null, "target": "Journal
Voucher", "source_type": "Master"},
{"source": "Account", "target_type": "Master", "target": "Mode of
Payment", "source_type": "Master"},

Is there a data dictionary in the database somewhere that describes
the relationships between database tables and describing relation type
eg: 1 to many; many to many etc...

In addition are there any diagrams showing the tables layed out using
a err diagramming tool like "mysql-workbench"

I would like to contribute to the project some of the systems we have
developed for our internal accounting over the years and teh ER
Diagram is
absolutely necessary to be an effective contributor.

Thanks.

Rushabh Mehta

unread,
May 8, 2013, 7:53:56 AM5/8/13
to erpnext-dev...@googlegroups.com, er...@sysv.com
Hi Erran,

Unfortunately no ER diagram yet. But you can use MySQL workbench and other such schema browsing tools to get started.

best,
Rushabh


W: https://erpnext.com
T: @rushabh_mehta

--
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To post to this group, send email to erpnext-dev...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



Erran Botha

unread,
May 8, 2013, 8:08:19 PM5/8/13
to erpnext-dev...@googlegroups.com, er...@sysv.com
You must at least have a data dictionary besides the relationships in the sample source code?
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsub...@googlegroups.com.

Rushabh Mehta

unread,
May 8, 2013, 10:53:21 PM5/8/13
to erpnext-dev...@googlegroups.com
Erran,

The table relationships are exactly same as DocTypes. Every time a DocType is saved, the schema is updated. You can get a better idea by browsing DocTypes. If you are logged in as Administrator, go to #List/DocType in the url

best,
Rushabh


W: https://erpnext.com
T: @rushabh_mehta

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.

To post to this group, send email to erpnext-dev...@googlegroups.com.

Erran Botha

unread,
May 11, 2013, 6:22:59 AM5/11/13
to erpnext-dev...@googlegroups.com
Thanks Rushabh,

That worked.

If the database tables are created by the Doc Types definition then where are the doc type definitions stored? In the database?
Where exactly are the primary key and foreign keys defined for each doc/table?

Why do some tables not have a primary key of a unique "id" but appear to use the name/description as the key to join to other tables eg contact.name etc..
This seems to create a problem with updating the name and having to deal with cascading updates to other tables violating basic database normalization standards.

Have I missed something basic here?

Rushabh Mehta

unread,
May 13, 2013, 12:31:03 AM5/13/13
to erpnext-dev...@googlegroups.com
Erran,

Replies below:


On Sat, May 11, 2013 at 3:52 PM, Erran Botha <erran...@gmail.com> wrote:
Thanks Rushabh,

That worked.

If the database tables are created by the Doc Types definition then where are the doc type definitions stored? In the database?

In ".txt" files -- for example app/accounts/doctype/account/account.txt - whenever you update the system using "lib/wnf.py --update" all schema is automatically updated
 
Where exactly are the primary key and foreign keys defined for each doc/table?

"Link" fields are foreign keys.
 

Why do some tables not have a primary key of a unique "id" but appear to use the name/description as the key to join to other tables eg contact.name etc..

All tables have a unique "name" (which is actually id). This could be a numeric series or name (based on user preferences in masters like Customer, Supplier, Item)
 
This seems to create a problem with updating the name and having to deal with cascading updates to other tables violating basic database normalization standards.

We have a slightly custom designs for this. For cascading updates, you have to use the API - all the triggers are written in Python files in the DocType folders (see the account folder)
 
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.

To post to this group, send email to erpnext-dev...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 



--



Twitter: @rushabh_mehta
Reply all
Reply to author
Forward
0 new messages