Arregla búsqueda en el TPV.
No encuentra artículos introduciendo tildes.
This commit is contained in:
parent
f93bc37942
commit
0e2919d1eb
4 changed files with 52 additions and 79 deletions
|
@ -1,23 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
##############################################################################
|
|
||||||
#
|
|
||||||
# OpenERP, Open Source Management Solution
|
|
||||||
# Copyright (C) 2013-Today OpenERP SA (<http://www.openerp.com>).
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU Affero General Public License as
|
|
||||||
# published by the Free Software Foundation, either version 3 of the
|
|
||||||
# License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU Affero General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
##############################################################################
|
|
||||||
|
|
||||||
import models
|
|
||||||
#import controllers
|
|
|
@ -1,28 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
{
|
|
||||||
'name': 'Product Library',
|
|
||||||
'category': 'Product',
|
|
||||||
'summary': 'Add library related fields to product',
|
|
||||||
'version': '0.1',
|
|
||||||
'description': """
|
|
||||||
|
|
||||||
Add several fields to product for libraries
|
|
||||||
==================================================
|
|
||||||
Autor, coleccion, ISBN,....
|
|
||||||
|
|
||||||
""",
|
|
||||||
'author': 'Criptomart',
|
|
||||||
'depends': [
|
|
||||||
'product',
|
|
||||||
'point_of_sale',
|
|
||||||
],
|
|
||||||
'data': [
|
|
||||||
'views/product.xml',
|
|
||||||
'views/templates.xml'
|
|
||||||
],
|
|
||||||
'demo': [],
|
|
||||||
'installable': True,
|
|
||||||
'auto_install': False,
|
|
||||||
'application': True,
|
|
||||||
}
|
|
|
@ -1,10 +1,21 @@
|
||||||
odoo.define('product_library', function (require) {
|
odoo.define('product_library', function (require) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
var db = require("point_of_sale.DB");
|
var db = require("point_of_sale.DB");
|
||||||
db.include({
|
db.include({
|
||||||
|
|
||||||
_product_search_string: function(product){
|
normalize_characters: function (product) {
|
||||||
|
// The normalization extract out combining diacritical marks
|
||||||
|
// All those diacritics in range [\u0300-\u036f].
|
||||||
|
// See https://en.wikipedia.org/wiki/Combining_Diacritical_Marks.
|
||||||
|
// All the diacritics are removed by the code below.
|
||||||
|
return product.normalize("NFD")
|
||||||
|
.replace(/[\u0300-\u036f]/g, "")
|
||||||
|
.replace(/[\u0152-\u0153]/g, "oe");
|
||||||
|
},
|
||||||
|
|
||||||
|
add_custom_fields: function(product) {
|
||||||
|
if(product) {
|
||||||
var str = product.display_name;
|
var str = product.display_name;
|
||||||
if(product.default_code){
|
if(product.default_code){
|
||||||
str += '|' + product.default_code;
|
str += '|' + product.default_code;
|
||||||
|
@ -18,7 +29,6 @@
|
||||||
if(product.editorial){
|
if(product.editorial){
|
||||||
str += '|' + product.editorial;
|
str += '|' + product.editorial;
|
||||||
}
|
}
|
||||||
str += '|' + product.description;
|
|
||||||
/*
|
/*
|
||||||
if (product.description) {
|
if (product.description) {
|
||||||
str += '|' + product.description;
|
str += '|' + product.description;
|
||||||
|
@ -28,10 +38,24 @@
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
str = product.id + ':' + str.replace(':','') + '\n';
|
str = product.id + ':' + str.replace(':','') + '\n';
|
||||||
|
}
|
||||||
return str;
|
return str;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_product_search_string: function(product) {
|
||||||
|
console.log("product : " + JSON.stringify(product, null, 4));
|
||||||
|
var str = this.add_custom_fields(product);
|
||||||
|
console.log("string : " + str);
|
||||||
|
var norm = this.normalize_characters(str);
|
||||||
|
console.log("normalizado : " + norm);
|
||||||
|
return norm;
|
||||||
|
},
|
||||||
|
/*
|
||||||
|
search_product_in_category: function (category_id, query) {
|
||||||
|
return this._super(category_id, this.add_custom_fields(query));
|
||||||
|
},*/
|
||||||
});
|
});
|
||||||
|
|
||||||
return db;
|
return db;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -18,7 +18,7 @@ Overload models.PosModel
|
||||||
this.member_categories = [];
|
this.member_categories = [];
|
||||||
|
|
||||||
var product_model = _.find(this.models, function(model){ return model.model === 'product.product'; });
|
var product_model = _.find(this.models, function(model){ return model.model === 'product.product'; });
|
||||||
product_model.fields.push('default_code');
|
//product_model.fields.push('default_code');
|
||||||
product_model.fields.push('autor');
|
product_model.fields.push('autor');
|
||||||
product_model.fields.push('editorial');
|
product_model.fields.push('editorial');
|
||||||
product_model.fields.push('genero');
|
product_model.fields.push('genero');
|
||||||
|
|
Loading…
Add table
Reference in a new issue