Odoo Help


Limiting search results for a many2one lookup combo-box within inline editing

Ralph Fuechtenkort
on 8/5/13, 12:04 AM 1,009 views

I have a model for a master detail relationship. The Mater Table is "Vehicles", which contains a car model as a many2one association. Within the Details many2one configuration items (as air-con, color etc) for that vehicle should be saved. This Table has a reference to the vehicle same as a pricelist model where details as name and price for that items are stored.

Now i wish to limit the search results of the combo box for the pricelist (I use editable=bottom) should be limited by items available for that model (as there are too many in the db for all models).

I tried the following "domain" code in the price list_id row, but it seems the fields are not available, as they belong to the parent.

class vehicle_configuration(osv.Model): _name = 'gn.fc.vehicle.configuration' _description ='Cars current configuration'

_columns = {
    'name': fields.text('Description', required=True, readonly=False),
    'vehicle_id': fields.many2one('gn.fc.vehicle', 'Vehicle Reference', select=True, required=True, ondelete='cascade'),
    'pricelist_id': fields.many2one('gn.fc.vehicle.configuration.pricelist', 'Pricelist',domain="[('model_id.id','=',vehicle_id.model_id.id)]"),
    'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Product Price')),

My Question is there a way to access the parent entities, in this case the model id stored in the vehicle like "parent.vehicle_id.model_id" to limit the search result for pricelist items for a specific model?

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 8/5/13, 12:04 AM
Seen: 1009 times
Last updated: 3/16/15, 8:10 AM