Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
Hi, in product template I have defined one2many field to get something like this:
BRAND MODEL INIT YEAR FINAL YEAR
nissan sentra 2000 2005
mazda aveo 1998 2004
The aim of this structure is to be able to search by model and year. Using the search box and typing 'sentra' as Model parameter, I get product A, this is great, just after this, I type 1998 as 'Search year' parameter and I also get product A because 1998 is part of range in row 2, this is wrong according to my requirement.
Is it possible that after typing the model paramater search the year only in the row in which appears the desired model?
Some piece of code:
<field string="Model" name="application_data_product_template_ids" filter_domain="[('application_data_product_template_ids.model', 'ilike',self)]"/>
<field name="date_search" />
def _search_year(self, cr, uid, obj, name, args, context):
x = [('application_data_product_template_ids.date_beg', '<=', args), ('application_data_product_template_ids.dateend', '>=', args)]
res = self.search(cr, uid, x, context=context)
return [('id', 'in', res)]
'date_search': fields.function(lambda self: self, string='Search year', type='integer', fnct_search=_search_year),
Please, give some suggestions!!
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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 5/26/15, 1:58 AM|
|Seen: 639 times|
|Last updated: 5/26/15, 1:58 AM|