Skip to Content
Menu
This question has been flagged
Hello
I'm working in Odoo 12, in the website module.
I'm trying to create a list of customers in a new view of the cart flow, I've already got the list of values for the radio input.
I was planning on handling the submition of the form with javacript, but the code I wrote doesn't recognize the click event on the submit button (#submit-cliente in the xml).
I don't know if there is something I didn't put in the Javascript code, XML or something.


views/templates.xml

<template id="cliente" name="Cliente">
<t t-call="website.layout">
<div id="wrap">
<div class="container oe_website_sale py-2">
<div class="row">
<div class="col-12">
<t t-call="website_sale.wizard_checkout">
<t t-set="step" t-value="15" />
</t>
</div>
<div class="col-12 col-xl-8 oe_cart">
<div class="row">
<div class="col-lg-12">
<form id="form-cliente">
<t t-call="module_name.lista_clientes"/>
<div class="clearfix" />
<a role="button" href="/shop/cart" class="btn btn-secondary mb32 d-none d-xl-inline-block">
<span class="fa fa-chevron-left" />
<span class="">Volver al carrito</span>
</a>
                                    <a role="button" id="submit-cliente" t-if="website_sale_order and website_sale_order.website_order_line" class="btn btn-primary float-right d-none d-xl-inline-block boton-clientes">                                      <span class="">Procesar compra</span>
                                         <span class="fa fa-chevron-right" />
                                    </a>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</t>
</template>


The t-call to module_name.lista_clientes is:

    <template id="lista_clientes" name="Lista de clientes">
<div
class="card">
<table
class="table table-striped table-sm" id="cart_cliente" t-if="clientes">
<thead>
<tr>
<th
class="border-top-0">Nombre</th>
<th
class="border-top-0">RUC</th>
<th
class="border-top-0">Direccion</th>
<th
class="border-top-0">Telefono</th>
</tr>
</thead>
<tbody>
<tr
t-foreach="clientes" t-as="cliente">
<td class='td-product_name' t-if="cliente.name">
<div>
<label><input
type="radio" t-attf-id="{{cliente.id}}" t-attf-value="{{cliente.id}}" name="cliente"/><strong t-field="cliente.name" /></label>
</div>
</td>
<td
class='td-product_name' t-if="cliente.vat">
<div>
<strong
t-field="cliente.vat" />
</div>
</td>
<td
class='td-product_name' t-if="cliente.street">
<div>
<strong
t-field="cliente.street" />
</div>
</td>
<td
class='td-product_name' t-if="cliente.phone">
<div>
<strong
t-field="cliente.phone" />
</div>
</td>

</tr>
</tbody>
</table>
</div>
</template>


The Javascrip code is:

odoo.define('module_name.ClientesWidget', function(require) {
"use strict";

var
Widget = require('web.Widget');

var
ClientesWidget = Widget.extend({
events: {
'click a.boton-cliente''_onSubmitCliente',
},
_onSubmitClientefunction () {
console.log("Soy el click del submit");
},
});

return
ClientesWidget;

});
Avatar
Discard
Related Posts Replies Views Activity
0
Aug 24
478
1
May 24
641
2
Jan 23
14484
1
May 21
5883
2
Jun 20
2689