Odoo Help

0

0
3 Answers
0
Avatar

Med Said BARA

--Med Said BARA--

2824
| 6 5 8
Algerije
--Med Said BARA--
Med Said BARA
07-03-19 14:30

This is exactly what you need (a module with a simple JS file) (tested on V7.0): web_autoswitch_to_form

0
DenisK
04-03-19 01:45

Thanks for the reply. I've implemented for now in the JS code where I check the response items length. Changing the action/response on the server side may be a problem as I figured out when testing. Because when a user toggles back from the form mode to the list mode the same query is send to the server and would response the action to show the form mode again. So the user would stay trapped on the form view.

To manage this I've inspected the JS code if there is any condition to check whether the user searched by himself via the search field or if the search is fired by view toggling. In both cases the same information are send to the server. To modify the search field at this moment also seems to be no option.

So I came along working on the response client side to figure out if I should show the form or not. With a flag that indicates that the user currently switched from form to view mode I can surpress the redirect to the form if there was only one item returned in the search response.

0
DRC Systems
04-03-19 01:09

When you return the action on the button click, check in result how many record you are getting using len().

If you are getting exact 1 record then browse the particular models form view which you want to show and pass this in the action..

If  you are getting more than 1 record then browse the particular models list view which you want to show and pass this in the action..


Stel een vraag
Writer
Keep Informed
1 volger(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now