It is currently Wed May 23, 2012 2:52 pm

All times are UTC + 2 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: [Solved] Simple explanation of one2many, many2one...
PostPosted: Tue Aug 02, 2011 5:00 pm 
Offline

Joined: Mon May 16, 2011 4:20 pm
Posts: 27
Hello,

as the subject suggests, would you have a simple explanation of these three fields, it's difficult to capture their interest and in which situation to use one over the other.

Thank you in advance.


Last edited by kilrou on Wed Aug 03, 2011 10:31 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Simple explanation of one2many, many2one, many2many fiel
PostPosted: Wed Aug 03, 2011 12:47 am 
Offline

Joined: Fri May 21, 2010 10:03 pm
Posts: 94
Location: Belize
one2many:
invoice->invoice_line
An invoice has many lines.
In the database the lines each have a reference to their invoice.

many2one:
invoice->partner
Many invoices belong to a partner.
In the database the invoices each have a reference to their partner.

many2many:
users<->groups
A user belongs to many groups and a group has many users.
Or
A user has many groups and a group belongs to many users.
It works both ways.
In the database a separate table has a user-group reference pair for each relation.


Top
 Profile  
 
 Post subject: Re: Simple explanation of one2many, many2one, many2many fiel
PostPosted: Wed Aug 03, 2011 1:55 am 
Offline

Joined: Wed Jan 27, 2010 6:21 pm
Posts: 797
Location: Auckland, NZ
The explanation is correct in simple terms and common understanding, but in relational database terms it is more like

one2many
An invoice has 0,1 or many lines.
Note this is an important distinction as the one2one field type has been deprecated.

many2many
A user belongs to 0,1 or many groups and a group has 0,1, or many users.

_________________
Graeme


Top
 Profile  
 
 Post subject: Re: Simple explanation of one2many, many2one, many2many fiel
PostPosted: Wed Aug 03, 2011 10:30 am 
Offline

Joined: Mon May 16, 2011 4:20 pm
Posts: 27
Thanks for your good explanations.

Best regards.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 2 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:

Protected by Anti-Spam ACP