upgrade v16
separación de las funcionalidades del PoS en un módulo aparte
This commit is contained in:
parent
cb788d4a45
commit
386ae33d80
19 changed files with 184 additions and 386 deletions
33
pos_product_library/static/src/js/screens.js
Normal file
33
pos_product_library/static/src/js/screens.js
Normal 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;
|
||||
});
|
61
pos_product_library/static/src/xml/pos.xml
Normal file
61
pos_product_library/static/src/xml/pos.xml
Normal file
|
@ -0,0 +1,61 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<templates id="template" xml:space="preserve">
|
||||
<t
|
||||
t-name="ProductItem"
|
||||
t-inherit="point_of_sale.ProductItem"
|
||||
t-inherit-mode="extension"
|
||||
owl="1"
|
||||
>
|
||||
<xpath expr="//div[hasclass('product-content')]" position="inside">
|
||||
<div class="flex">
|
||||
<br/>
|
||||
<span><b> <t t-esc="props.product.formato"/></b></span>
|
||||
</div>
|
||||
</xpath>
|
||||
</t>
|
||||
<t t-inherit="point_of_sale.Orderline" t-inherit-mode="extension">
|
||||
<xpath expr="//span[hasclass('product-name')]" position="inside">
|
||||
<span>
|
||||
<br/>
|
||||
Formato: <t t-out="props.line.get_product().formato" />
|
||||
</span>
|
||||
</xpath>
|
||||
</t>
|
||||
<t
|
||||
t-name="ProductInfoPopup"
|
||||
t-inherit="point_of_sale.ProductInfoPopup"
|
||||
t-inherit-mode="extension"
|
||||
owl="1"
|
||||
>
|
||||
<xpath expr="//div[hasclass('section-product-info-title')]" position="after">
|
||||
<div class="section-product-info">
|
||||
<br/>
|
||||
<table class="mobile-table">
|
||||
<tr>
|
||||
<td>Formato:</td>
|
||||
<td><t t-out="props.product.formato" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Subtitulo:</td>
|
||||
<td><t t-out="props.product.subtitle" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Autor:</td>
|
||||
<td><t t-out="props.product.author" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Editorial:</td>
|
||||
<td><t t-out="props.product.editorial" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Entrada:</td>
|
||||
<td><t t-out="props.product.fecha_entrada" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Género:</td>
|
||||
<td><t t-out="props.product.genero" /></td>
|
||||
</tr>
|
||||
</div>
|
||||
</xpath>
|
||||
</t>
|
||||
</templates>
|
Loading…
Add table
Add a link
Reference in a new issue