跳至内容
菜单
此问题已终结
2 回复
4968 查看

I am in situation have to create many2one ean13 field in product when we use any one at barcode reader of POS it should fetch the all the data related to the product

形象
丢弃
编写者 最佳答案

I have created one2may field in product.product to assign the ean13 and got the data at point of sale then update the code

point_of_sale in db.js

        _product_search_string: function(product){
            1000
            var str = '' + product.id + ':' + product.name;
            if(product.ean13){
                str += '|' + product.ean13;
            }
            //added
            if(product.code){
                 str += '|' + product.code;

                }   
            //end
            // added customised for multiple bar codes for single product
            if(product.bar_code_ids){
                for (i in product.bar_code_ids){
                    for (j in this.bar_codes){
                        if (this.bar_codes[j].id === product.bar_code_ids[i]){
                            str += '|' + this.bar_codes[j].name;
                        }
                    }
                }
            }
            // end
            var packagings = this.packagings_by_product_id[product.id] || [];
            for(var i = 0; i < packagings.length; i++){
                str += '|' + packagings[i].ean;
            }
            return str + '\n';
        },

形象
丢弃

Where do i get this.bar_codes in this function ?

Can you please tell me ? I have go t the id of barcodes in one2many field but hoe can i make it searchable with the name of barcodes ?

最佳答案

There are modules to handle multiple ean13 per product. But i dont think it can work on pos front end.why not duplicate the product and just change the ean13 field

形象
丢弃