تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
6786 أدوات العرض

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.

الصورة الرمزية
إهمال
أفضل إجابة

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.

I have updated my answer

المنشورات ذات الصلة الردود أدوات العرض النشاط
1
نوفمبر 24
1174
4
أكتوبر 24
3418
0
أكتوبر 22
5105
0
سبتمبر 22
38
2
يناير 25
988