Frage

I have used all these 3 relational fields i.e many2one,one2many,many2many but still now I'm unable to know exactly how do they work internally,So please throw some light on their working .

War es hilfreich?

Lösung

I'll give you a simple example.

class a(osv.osv):
_name = 'a'
_columns = {
    'f1': fields.many2one('b', 'Creates new column "f1" in "a" table'),
    'f2': fields.one2many('b', 'xxx', 'Creates new column "xxx" in "b" table'),
    'f3': fields.many2many('b', 'aaa', 'a_id', 'b_id', 'Creates new table "aaa" with column "a_id" related to "a" object and column "b_id" related to "b" object'),
}
a()

class b(osv.osv):
    _name = 'b'
b()

You can always look on your database and compare it with code if my example wasn't clear.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top