Passa al contenuto
Odoo Menu
  • Accedi
  • Provalo gratis
  • App
    Finanze
    • Contabilità
    • Fatturazione
    • Note spese
    • Fogli di calcolo (BI)
    • Documenti
    • Firma
    Vendite
    • CRM
    • Vendite
    • Punto vendita Negozio
    • Punto vendita Ristorante
    • Abbonamenti
    • Noleggi
    Siti web
    • Configuratore sito web
    • E-commerce
    • Blog
    • Forum
    • Live chat
    • E-learning
    Supply chain
    • Magazzino
    • Produzione
    • PLM
    • Acquisti
    • Manutenzione
    • Qualità
    Risorse umane
    • Dipendenti
    • Assunzioni
    • Ferie
    • Valutazioni
    • Referral dipendenti
    • Parco veicoli
    Marketing
    • Social marketing
    • E-mail marketing
    • SMS marketing
    • Eventi
    • Marketing automation
    • Sondaggi
    Servizi
    • Progetti
    • Fogli ore
    • Assistenza sul campo
    • Helpdesk
    • Pianificazione
    • Appuntamenti
    Produttività
    • Comunicazioni
    • Approvazioni
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    App di terze parti Odoo Studio Piattaforma cloud Odoo
  • Settori
    Retail
    • Libreria
    • Negozio di abbigliamento
    • Negozio di arredamento
    • Alimentari
    • Ferramenta
    • Negozio di giocattoli
    Cibo e ospitalità
    • Bar e pub
    • Ristorante
    • Fast food
    • Pensione
    • Grossista di bevande
    • Hotel
    Agenzia immobiliare
    • Agenzia immobiliare
    • Studio di architettura
    • Edilizia
    • Gestione immobiliare
    • Impresa di giardinaggio
    • Associazione di proprietari immobiliari
    Consulenza
    • Società di contabilità
    • Partner Odoo
    • Agenzia di marketing
    • Studio legale
    • Selezione del personale
    • Audit e certificazione
    Produzione
    • Tessile
    • Metallo
    • Arredamenti
    • Alimentare
    • Birrificio
    • Ditta di regalistica aziendale
    Benessere e sport
    • Club sportivo
    • Negozio di ottica
    • Centro fitness
    • Centro benessere
    • Farmacia
    • Parrucchiere
    Commercio
    • Tuttofare
    • Hardware e assistenza IT
    • Ditta di installazione di pannelli solari
    • Calzolaio
    • Servizi di pulizia
    • Servizi di climatizzazione
    Altro
    • Organizzazione non profit
    • Ente per la tutela ambientale
    • Agenzia di cartellonistica pubblicitaria
    • Studio fotografico
    • Punto noleggio di biciclette
    • Rivenditore di software
    Carica tutti i settori
  • Community
    Apprendimento
    • Tutorial
    • Documentazione
    • Certificazioni 
    • Formazione
    • Blog
    • Podcast
    Potenzia la tua formazione
    • Programma educativo
    • Scale Up! Business Game
    • Visita Odoo
    Ottieni il software
    • Scarica
    • Versioni a confronto
    • Note di versione
    Collabora
    • Github
    • Forum
    • Eventi
    • Traduzioni
    • Diventa nostro partner
    • Servizi per partner
    • Registra la tua società di contabilità
    Ottieni servizi
    • Trova un partner
    • Trova un contabile
    • Incontra un esperto
    • Servizi di implementazione
    • Testimonianze dei clienti
    • Supporto
    • Aggiornamenti
    GitHub Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Richiedi una demo
  • Prezzi
  • Aiuto

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Contabilità
  • Magazzino
  • PoS
  • Progetti
  • MRP
All apps
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
Assistenza

Pause user interface during the calculation

Iscriviti

Ricevi una notifica quando c'è un'attività per questo post

La domanda è stata contrassegnata
onchangev14
2 Risposte
4879 Visualizzazioni
Avatar
Morvan QUEMENER

I added 2 columns in the sales order entry form. The 1st calculates the 2nd which can be possibly modified. My problem is that my cursor is positioned right away on the 2nd column, but the result appears only 1 to 2 seconds after.

I use onchange method to compute the field, is this the best way do that ?

I see 2 manners to obtain what i want :

- find a speeder way to get my result

- pause user interface until calculation is done (hourglass/gray screen)

Thank you in advance for any help you may offer.

0
Avatar
Abbandona
Jack Dane

Hello Morvan,

I have been looking further into this and I think I have found the solution!

Here is how you block the UI and I have tested a quick script with JQeury to run this with an Onchange event. Here is the code which was added to the back to make the event happen. This script was added to the Backend Assets.

<script type="text/javascript">

$(document).ready(function(){

$(document).on("change", "#o_field_input_27", function(){

$.blockUI();

setTimeout(function(){

$.unblockUI();

$("#o_field_input_28").focus();

}, 2000);

});

});

</script>

You need to find out the input id of the field and then call the blockUI funciton, set a delay of however long (2 seconds in this case) and then unblock the UI. You then find the next element, in your case the onchange field and set this as the new focus.

You can go further and only add this script depending on the model etc using t-if to not confuse with any other models.

Here is the documentation I have found relating to blocking the UI. http://malsup.com/jquery/block/#overview

Hope this solves the issue!

Thanks,

Avatar
Jack Dane
Risposta migliore

Hello Morvan,

It seems you are using an onchange, when really it should be a computed field. 

See the documentation here: https://www.odoo.com/documentation/14.0/reference/orm.html#module-odoo.api

You need to define the compute value as a field parameter then use @api.depends("field1"). This would make the field readonly by default, meaning the cursor will not appear on the field2. 

I believe this should fix your issue. 

EDIT:

I have been looking further into this and I think I have found the solution!

Here is how you block the UI and I have tested a quick script with JQeury to run this with an Onchange event. Here is the code which was added to the back to make the event happen. This script was added to the Backend Assets.

<script type="text/javascript">

$(document).ready(function(){

$(document).on("change", "#o_field_input_27", function(){

$.blockUI();

setTimeout(function(){

$.unblockUI();

$("#o_field_input_28").focus();

}, 2000);

});

});

</script>

You need to find out the input id of the field and then call the blockUI funciton, set a delay of however long (2 seconds in this case) and then unblock the UI. You then find the next element, in your case the onchange field and set this as the new focus.

You can go further and only add this script depending on the model etc using t-if to not confuse with any other models.

Here is the documentation I have found relating to blocking the UI. http://malsup.com/jquery/block/#overview

Hope this solves the issue!

0
Avatar
Abbandona
Morvan QUEMENER
Autore

Thank you for your answer but computed fields do not correspond to my request, in the perspective where the caculated value is the default value but can be modified by the user.

The first field is the number of packages, and the 2nd the numbers of unit, and because product are fruits and vegetables, this could be different.

Jack Dane

Apologies, I did not read the question properly, how about adding a read-only on the view for field 2. When field 2 is empty it is read-only, so it only becomes editable when it has a value?

Morvan QUEMENER
Autore

If i do that, the cursor will go to the next field after this one, and this is not what we want. Furthermore we will facing to the same issue, when user have to modifiy the order lines.

It seems to me to have already seen in Odoo, waiting times with hourglass/gray screen when the application is processing.

Jack Dane

time.sleep(x) will stop the current thread and will cause the loading screen, but there is about 2-second delay before the loading screen pops up, sorry I couldn't be much help

Avatar
Morvan QUEMENER
Autore Risposta migliore

.

0
Avatar
Abbandona
Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!

Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!

Registrati
Post correlati Risposte Visualizzazioni Attività
Onchange not triggered when record is altered from python code Risolto
onchange v14
Avatar
Avatar
1
dic 21
7087
Use Onchange on one record to change fields on other records. Risolto
sale onchange v14
Avatar
Avatar
2
gen 25
45449
Odoo14 alternative for Automated Translations through Gengo API module
v14
Avatar
Avatar
Avatar
Avatar
3
set 25
3566
Odoo Community v14 Slow on High-End Servers, Fast on i5/i7 PCs
v14
Avatar
0
ago 25
1030
How to Managing Birthdate and Age in Odoo
v14
Avatar
Avatar
1
ago 25
3385
Community
  • Tutorial
  • Documentazione
  • Forum
Open source
  • Scarica
  • Github
  • Runbot
  • Traduzioni
Servizi
  • Hosting Odoo.sh
  • Supporto
  • Aggiornamenti
  • Sviluppi personalizzati
  • Formazione
  • Trova un contabile
  • Trova un partner
  • Diventa nostro partner
Chi siamo
  • La nostra azienda
  • Branding
  • Contattaci
  • Lavora con noi
  • Eventi
  • Podcast
  • Blog
  • Clienti
  • Note legali • Privacy
  • Sicurezza
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo è un gestionale di applicazioni aziendali open source pensato per coprire tutte le esigenze della tua azienda: CRM, Vendite, E-commerce, Magazzino, Produzione, Fatturazione elettronica, Project Management e molto altro.

Il punto di forza di Odoo è quello di offrire un ecosistema unico di app facili da usare, intuitive e completamente integrate tra loro.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now