Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save button in ListView.buttons edit mode doesn't save records when pressing on span or icon #2558

Open
ShiroPeDeFresa opened this issue Jul 10, 2023 · 3 comments
Labels

Comments

@ShiroPeDeFresa
Copy link

ShiroPeDeFresa commented Jul 10, 2023

Changes are not applying when clicking on icon or span inside the save button once you install web_responsive module

Module

web_responsive

Describe the bug

'button' tag has class="o_list_button_save" so when you click on it, it calls the create method from the module. but 'i' and 'span' doesn't have it, I tried to add o_list_button_save to them manually on f12 view, and once added it, i got successfuly redirected to create method so it seems to fix it, for example:
This should throw a warn saying you must fill the required field when pressing on Save button,
image

The problem is that if you click on the span or the icon inside the button, nothing happen at all it just erases the record and exit the edit mode, but if you click behind, on the button itself:
image
It does throw the warn
image

I noticed it doesnt make it to create method because once I had a compilation error while making some test on a custom module, and it only throwed an error when I clicked outside the text too.
This behavior happens in every editable list view, not only in my custom module, i tried in different projects.

To Reproduce

Affected versions: I only tried on Odoo v15

Steps to reproduce the behavior:

  1. Install Web Responsive module
  2. Go to an editable List view
  3. Create a new record WITHOUT ADDING FIELDS MANUALLY (this is because once you write something inside a field, it is saved even if you press outside the save button. Just press "Create" and then "Save"
  4. Try saving it pressing on text/icon and then trying but pressing outside those areas

Expected behavior
If you click ON the text/icon, it wont save, but if you click OUTISDE, it will.

Sorry for my bad english, I hope you can understand it correctly;
Thank you!

@ShiroPeDeFresa ShiroPeDeFresa changed the title Save button in ListView.buttons edit mode Save button in ListView.buttons edit mode doesn't save records when pressing on span or icon Jul 10, 2023
@pedrobaeza
Copy link
Member

This is something expected, as there are mandatory fields that are not filled.

Closing as no bug, but expected behavior.

@ShiroPeDeFresa
Copy link
Author

ShiroPeDeFresa commented Jul 10, 2023

Sorry I may didn't express myself correctly, please let me correct myself in english and spanish so I can express better for you:

[ENG]

Excuse me Pedro, I may not express my issue clearly enough, I know that the error is mandatory and it must appear, it was an example that is should've been thrown, but it doesn't happen because when you click on the text or the icon it skips all adittions to list.
The issue is that the button "Save" behavior is different depending if you press on the elements inside the button, or behind them, on the button itself
<button type="button" class="btn btn-primary o_list_button_save" title="Guardar registro" data-hotkey="s"> <i class="fa fa-check" title="Guardar"></i> <span class="d-none d-sm-inline">Guardar</span> </button>
I figured out that in this HTML, it only goes to Create method when you DON'T click on <i> or on <span>

image
You can see these elements surrounded in red, when I click on them it just skips my row and the error that should appear, doesn't appear, but if I click outside the red zones, it does go to Create method and error finally appears as it should.

The issue is not the error message, when I try this with forms with no required fields, it also doesn't save and skips unless you click outside the mentioned areas, Notice that if you add fields manually, writing or selecting something, it saves, but not because the save button is working, on this kind of forms, view format, once you write or select a field, you can click wherever outside the buttons and it saves anyway.

I tried to add o_list_button_save inside the button's Span and Icon and it worked all along, here you can see an example on video.
I insist, the issue is not the error message, the issue is that it doesn't pop up when clicking on span or icon.

This happen once you install the web_responsive module
https://github.com/OCA/web/assets/99836064/f2bcb3e0-d1e9-4ee7-9653-8269e944cffd

[ESP]

Disculpa Pedro, quizá no expresé correctamente mi problema, sé que el mensaje de advertencia es mandatorio y debe ser así. Era un ejemplo de que debería saltar el error, sin embargo no ocurre porque al clicar en el texto, ignora toda adición a la lista.

El problema que describo es que el comportamiento del botón difiere según si clicas en el "Span" o icono, o si clicas detrás,
en el momento en que clicas sobre ya sea el "Span" que contiene el texto de "Guardar" o el icono del "check", no redirige al método "create" y no salta la excepción que debería saltar, tanto el "Span" como el icono están sobrepuestos al botón en sí
<button type="button" class="btn btn-primary o_list_button_save" title="Guardar registro" data-hotkey="s"> <i class="fa fa-check" title="Guardar"></i> <span class="d-none d-sm-inline">Guardar</span> </button>
he comprobado que si en este fragmento de HTML, únicamente lleva al método Create cuando NO clicas sobre el <i> o sobre el <span>

image
Si se fija, en rojo enmarco las áreas correspondientes a estos dos elementos, cuando clico sobre ellos, salta el registro, y el error que debería salir, no aparece en pantalla, en cambio si clico fuera de esas áreas marcadas en rojo, sí lleva al método "Create" y el error que debería de saltar entonces aparece.

En casos en los que no haya campos obligatorios, simplemente ocurre que si clicas sobre las áreas, tu registro no se añade, y si clicas fuera, sí se añade.
Notar que si añades valores a los campos ya sea escribiendo o seleccionando a mano algo de un desplegable, este registro se guarda, pero no gracias al botón de guardar, sino porque una vez añadidos campos en este tipo de formularios, aunque cliques en áreas blancas fuera de los botones, el registro también se guarda.

Probé a añadir o_list_button_save en el "Span" y el icono y el botón funcionó homogéneamente, adjunto video demostrativo
insisto, el problema que dicto no es que salte la advertencia, el problema precisamente es que no salte.
Esto ocurre una vez instalado el módulo de web_responsive
https://github.com/OCA/web/assets/99836064/f2bcb3e0-d1e9-4ee7-9653-8269e944cffd

@pedrobaeza
Copy link
Member

OK, thanks for the extra explanations. Please do a PR proposing the patch.

@pedrobaeza pedrobaeza reopened this Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants