Odoo Help


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.


How to define a default external id in one2many field

badr elmar
on 4/25/16, 7:23 AM 338 views

I have 2 models with a relation one2many and many2one.

fieldmodel A = one2many model B

fieldmodel B = many2one model A

For every record B, I want to get the id of the record A (associate to B) generated by default when i open the field B

Any help please 

" generated by default" means generated form demo data ?

Prakash Sharma
on 4/25/16, 8:15 AM

It means that the id of field A appears automatically (by default) when i click on the record B

badr elmar
on 4/25/16, 8:21 AM

you can search in B using this domain 

self.pool.get(model.a).search(cr, uid, [('m2o filed ', 'in',  [currentids] )],context=context)

Krupesh Laiya
on 4/25/16, 7:56 AM

Thanks. But where i will define this domain

badr elmar
on 4/25/16, 8:38 AM

Where i have to add this domain please ??

badr elmar
on 4/25/16, 11:25 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)


Asked: 4/25/16, 7:23 AM
Seen: 338 times
Last updated: 4/25/16, 8:31 AM