Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Whats the difference between 'other.object.name' and 'Field relation id'?

By
Lakay lakay
on 9/2/14, 4:04 AM 981 views

fields.one2many( 'other.object.name', 'Field relation id', 'Fieldname', optional parameter)

using a one2many relational field type,  whats the difference between 'other.object.name' and 'Field relation id'

i know the where to find the 'other.object.name'  it is simply the "class" in the python code(module.py) and the "model" in the openerp , but what about the 'Field relation id' where can i find this? Thx in advance..

0

René Schuster

--René Schuster--
1560
| 5 5 8
Weinheim, Germany
--René Schuster--

Challenge Everything!

René Schuster
On 9/2/14, 4:25 AM

As one2many fields are not really stored in with all related ids, you have to define a relation field id. This is the many2one field in the 'other.object.name' table, that links to your actual table.

Example:

m2o: child_class with field parent_class_id.
o2m: parent_class with field child_class_ids.   In this one2many field the 'other.object.name' is the name of the child_class (e.g. child.class) and the 'Field relation id' is parent_class_id.

 

Regards.

could you help me im confused. i have this code: class si(osv.osv): _name='si' _columns ={ 'siid':fields.many2one('osa'), } si() class osa(osv.osv): _name='osa' _columns={ 'street':fields.char('Street',size=100,required=True), } osa() i have this existing code, as you can see the field 'siid' is many2one it means that it can only refer to a one class which is the 'osa' when you try to add value to the 'siid' field it will redirect you to the one (1) 'street' field and enter values then save. what will i need to do if when i add value to the 'siid' field it will enables me to enter many 'street' and this 'street' will have an identification that it was entered by the current user of the openerp (its like one2many | many 'street' just for one user). Do i need to add another field as their (ids) to both classes as their reference ?

Lakay lakay
on 9/2/14, 4:51 AM

I don't get you. Sorry.

René Schuster
on 9/2/14, 5:03 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 9/2/14, 4:04 AM
Seen: 981 times
Last updated: 3/16/15, 8:10 AM