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

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

By
Ralph Fuechtenkort
on 8/5/13, 12:04 AM 678 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?

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

0 follower(s)

Stats

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