Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textile
    • Kov
    • Nábytek
    • Jídlo
    • Brewery
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • IT hardware a podpora
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Browse all Industries
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Services for Partners
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

Pause user interface during the calculation

Odebírat

Get notified when there's activity on this post

This question has been flagged
onchangev14
2 Odpovědi
4882 Zobrazení
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
Zrušit
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
Nejlepší odpověď

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
Zrušit
Morvan QUEMENER
Autor

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
Autor

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
Autor Nejlepší odpověď

.

0
Avatar
Zrušit
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
Onchange not triggered when record is altered from python code Vyřešeno
onchange v14
Avatar
Avatar
1
pro 21
7091
Use Onchange on one record to change fields on other records. Vyřešeno
sale onchange v14
Avatar
Avatar
2
led 25
45457
Odoo14 alternative for Automated Translations through Gengo API module
v14
Avatar
Avatar
Avatar
Avatar
3
zář 25
3570
Odoo Community v14 Slow on High-End Servers, Fast on i5/i7 PCs
v14
Avatar
0
srp 25
1031
How to Managing Birthdate and Age in Odoo
v14
Avatar
Avatar
1
srp 25
3390
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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