LaOsaCoop/Odoo16#109 migrated website_search_products
This commit is contained in:
parent
26dbe222dd
commit
f1a3a75988
11 changed files with 525 additions and 0 deletions
95
website_search_products/views/web_templates.xml
Normal file
95
website_search_products/views/web_templates.xml
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright 2021 Criptomart
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
|
||||
<odoo>
|
||||
|
||||
<template id="web_list_products" name="Product List">
|
||||
<t t-call="website.layout">
|
||||
<div id="wrap">
|
||||
<div class="container">
|
||||
<div class="col-md-12">
|
||||
<t t-if="products">
|
||||
<div class="alert alert-success">
|
||||
Displayed products
|
||||
</div>
|
||||
</t>
|
||||
<t t-if="not products">
|
||||
<div class="alert alert-danger">
|
||||
Products not found
|
||||
</div>
|
||||
</t>
|
||||
<div class="col-md-12" style="text-align: center;">
|
||||
<h2>In this table you can consult all the products available in the store</h2>
|
||||
<h5>Please note that there may be minor discrepancies, which are updated as we perform the recurrent inventories.</h5>
|
||||
</div>
|
||||
<div class="col-md-12" style="margin-top: 50px;">
|
||||
<table id="productTable" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Category</th>
|
||||
<th>Price</th>
|
||||
<th>Quantity</th>
|
||||
<th>UoM</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="stockList">
|
||||
<t t-foreach="products" t-as="product">
|
||||
<tr>
|
||||
<td>
|
||||
<span t-esc="product.name" />
|
||||
</td>
|
||||
<td>
|
||||
<span t-esc="product.categ_id.name" />
|
||||
</td>
|
||||
<td>
|
||||
<span t-esc="product.list_price"
|
||||
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}" />
|
||||
</td>
|
||||
<td>
|
||||
<span t-esc="product.sudo().qty_available"
|
||||
t-options="{'widget': 'float', 'precision': 2}" />
|
||||
</td>
|
||||
<td>
|
||||
<span t-esc="product.sudo().uom_id.name" />
|
||||
</td>
|
||||
</tr>
|
||||
</t>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<link rel="stylesheet"
|
||||
href="https://cdn.datatables.net/2.0.0/css/dataTables.dataTables.css" />
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/2.0.0/js/dataTables.js"></script>
|
||||
<script>
|
||||
// Esperar a que jQuery esté disponible
|
||||
(function waitForJQuery() {
|
||||
if (typeof jQuery !== 'undefined') {
|
||||
jQuery(document).ready(function($) {
|
||||
$('#productTable').DataTable({
|
||||
"pageLength": 100,
|
||||
"order": [[1, "asc"], [0, "asc"], [2, "desc"]],
|
||||
"layout": {
|
||||
"topStart": "pageLength",
|
||||
"topEnd": "search",
|
||||
"bottomStart": "info",
|
||||
"bottomEnd": "paging"
|
||||
},
|
||||
"language": {
|
||||
"url": "https://cdn.datatables.net/plug-ins/1.13.1/i18n/es-ES.json"
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
setTimeout(waitForJQuery, 100);
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
</odoo>
|
||||
Loading…
Add table
Add a link
Reference in a new issue