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.

1

How to make changes in existing search parameters in point of sale Js files in openerp 7.0 ?

By
Sohail
on 5/4/13, 8:23 AM 1,884 views

I am new to Openerp 7.0 and finding it difficult to add an extra search parameter in the js file in the point of sale module.

2
Sreedath Namangalam
On 8/2/13, 4:53 AM

In db.js, modify the _product_search_string function as you need. For example, if you want to add searching for default_code also, then the function can be written as,

_product_search_string: function(product){
            var str = '' + product.id + ':' + product.name;
            if(product.ean13){
                str += '|' + product.ean13;
            }
            if(product.default_code){
                str += '|' + product.default_code;
            }
            var packagings = this.packagings_by_product_id[product.id] || [];
            for(var i = 0; i < packagings.length; i++){
                str += '|' + packagings[i].ean;
            }
            return str + '\n';
        },

And in the models.js file, in the function load_server_data, in the delf.fetch part of product.product, add the field default_code.

 return self.fetch(
  'product.product', 
   fields=['name', 'list_price','price','pos_categ_id', 'taxes_id', 'ean13', 'default_code',
   'to_weight', 'uom_id', 'uos_id', 'uos_coeff', 'mes_type', 'description_sale', 'description'],
    domain=[['sale_ok','=',true],['available_in_pos','=',true]],
  {pricelist: self.get('shop').pricelist_id[0]} // context for price
    );

The example above doesn't do anything for me.

Branimir
on 8/4/13, 6:56 AM

I have updated my answer

Sreedath Namangalam
on 8/5/13, 2:44 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

0 follower(s)

Stats

Asked: 5/4/13, 8:23 AM
Seen: 1884 times
Last updated: 3/16/15, 8:10 AM