Adding Product Category in Quotation Line Item Product Search

In addition to the existing product name and internal reference field based search we have been asked to include product category in quotation line item product search by few hospitals.

We see it as a valid requirement specially when the billing department has to enter other charges which are not synced from Bahmni and are based on bed types or insurance e.g. room charges, procedural charges etc. For such products bed type becomes a product category and makes it easy to search if the category name is included in the product search in quotation line.

We implemented this by adding the following lines of code in /usr/lib/python2.6/site-packages/openerp-7.0_20130301_002301-py2.6.egg/openerp/addons/bahmni_stock_batch_sale_price/product.py

if len(ids) < limit:
    args = args + [('id', 'not in', ids)]
    ids.extend(self.search(cr, user, args + [('categ_id', 'ilike', name_starts_with)], order="categ_id", limit=limit, context=context))

where categ_id is product category id which is a part of product_template which is base class for product_product