upgrade v16

separación de las funcionalidades del PoS en un módulo aparte
This commit is contained in:
snt 2024-09-04 22:25:51 +02:00 committed by snt
parent 70679c57a3
commit 308b3c4353
19 changed files with 184 additions and 386 deletions

View file

@ -0,0 +1,33 @@
odoo.define('product_library.screens', function (require) {
"use strict";
var ProductScreen = require('point_of_sale.ProductScreen');
var Registries = require('point_of_sale.Registries');
const LibraryProductScreen = (ProductScreen) =>
class extends ProductScreen {
_searchProduct(event) {
const query = event.target.value.trim().toLowerCase();
if (query) {
const products = this.env.pos.db.get_product_by_category(0).filter(product => {
return product.display_name.toLowerCase().includes(query) ||
product.autor.toLowerCase().includes(query) ||
product.editorial.toLowerCase().includes(query);
});
this.env.pos.db.add_products(products);
} else {
this.env.pos.db.add_products(this.env.pos.db.get_product_by_category(0));
}
this.render();
}
mounted() {
super.mounted();
this.el.querySelector('.searchbox input').addEventListener('input', this._searchProduct.bind(this));
}
};
Registries.Component.extend(ProductScreen, LibraryProductScreen);
return LibraryProductScreen;
});