Skip to Content
Odoo Меню
  • Увійти
  • Спробуйте це безкоштовно
  • Додатки
    Фінанси
    • Бухоблік
    • Виставлення рахунку
    • Витрати
    • Електронні таблиці (BI)
    • Документи
    • Підпис
    Продажі
    • CRM
    • Продажі
    • POS Магазин
    • POS Ресторан
    • Підписки
    • Оренда
    Веб-сайти
    • Конструктор веб-сайту
    • Електронна комерція
    • Блог
    • Форум
    • Живий чат
    • Електронне навчання
    Ланцюг поставок
    • Склад
    • Виробництво
    • PLM
    • Купівлі
    • Технічне обслуговування
    • Якість
    Кадри
    • Співробітники
    • Рекрутинг
    • Відпустки
    • Оцінювання
    • Рекомендації
    • Автотранспорт
    Маркетинг
    • Маркетинг соцмереж
    • Email-маркетинг
    • SMS-маркетинг
    • Події
    • Автом. маркетингу
    • Опитування
    Послуги
    • Проект
    • Табелі
    • Виїзне обслуговування
    • Служба підтримки
    • Планування
    • Призначення
    Продуктивність
    • Обговорення
    • Схвалення
    • IoT
    • IP-телефонія
    • База знань
    • WhatsApp
    Сторонні модулі Odoo Studio Платформа Odoo Cloud
  • Сфери
    Роздрібна торгівля
    • Книжковий магазин
    • Магазин одягу
    • Магазин меблів
    • Продуктовий магазин
    • Магазин будівельних матеріалів
    • Магазин іграшок
    Food & Hospitality
    • Бар та паб
    • Ресторан
    • Фастфуд
    • Guest House
    • Дистриб'ютор напоїв
    • Hotel
    Нерухомість
    • Real Estate Agency
    • Архітектурна фірма
    • Будівництво
    • Управління нерухомістю
    • Садівництво
    • Асоціація власників нерухомості
    Консалтинг
    • Бухгалтерська компанія
    • Партнер Odoo
    • Агенція маркетингу
    • Юридична фірма
    • Придбання Талантів
    • Аудит та сертифікація
    Виробництво
    • Textile
    • Metal
    • Меблі
    • Їжа
    • Brewery
    • Корпоративні подарунки
    Здоров'я & Фітнес
    • Спортивний клуб
    • Оптика
    • Фітнес-центр
    • Практики здоров'я
    • Аптека
    • Салон краси
    Trades
    • Ремонтник
    • IT-обладнання та Підтримка
    • Системи сонячної енергії
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Інші
    • Nonprofit Organization
    • Екологічна агенція
    • Оренда білбордів
    • Фотографія
    • Лізинг велосипедів
    • Реселлер програмного забезпечення
    Browse all Industries
  • Спільнота
    Навчання
    • Навчальний посібник
    • Документація
    • Сертифікації
    • Тренування
    • Блог
    • Подкаст
    Сприяйте Освіті
    • Програма навчання
    • Бізнес гра Scale Up!
    • Відвідайте Odoo
    Отримайте програмне забезпечення
    • Завантаження
    • Порівняйте версії
    • Релізи
    Співпрацюйте
    • Github
    • Форум
    • Події
    • Переклади
    • Стати партнером
    • Services for Partners
    • Зареєструйте вашу бухгалтерську фірму
    Отримайте послуги
    • Знайдіть партнера
    • Знайдіть бухгалтера
    • Зустріньтеся з консультантом
    • Послуги з впровадження
    • Референси клієнтів
    • Підтримка
    • Оновлення
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Отримати демо
  • Ціни
  • Допомога

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

  • CRM
  • e-Commerce
  • Бухоблік
  • Склад
  • PoS
  • Проект
  • MRP
All apps
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
All Posts Люди Значки
Мітки (View all)
odoo accounting v14 pos v15
Про цей форум
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
All Posts Люди Значки
Мітки (View all)
odoo accounting v14 pos v15
Про цей форум
Допомога

Pause user interface during the calculation

Підписатися

Отримуйте сповіщення про активність щодо цієї публікації

Це запитання позначене
onchangev14
2 Відповіді
4886 Переглядів
Аватар
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
Аватар
Відмінити
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,

Аватар
Jack Dane
Найкраща відповідь

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
Аватар
Відмінити
Morvan QUEMENER
Автор

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
Автор

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

Аватар
Morvan QUEMENER
Автор Найкраща відповідь

.

0
Аватар
Відмінити
Enjoying the discussion? Don't just read, join in!

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

Реєстрація
Related Posts Відповіді Переглядів Дія
Onchange not triggered when record is altered from python code Вирішено
onchange v14
Аватар
Аватар
1
груд. 21
7093
Use Onchange on one record to change fields on other records. Вирішено
sale onchange v14
Аватар
Аватар
2
січ. 25
45464
Odoo14 alternative for Automated Translations through Gengo API module
v14
Аватар
Аватар
Аватар
Аватар
3
вер. 25
3573
Odoo Community v14 Slow on High-End Servers, Fast on i5/i7 PCs
v14
Аватар
0
серп. 25
1032
How to Managing Birthdate and Age in Odoo
v14
Аватар
Аватар
1
серп. 25
3390
Спільнота
  • Навчальний посібник
  • Документація
  • Форум
Open Source
  • Завантаження
  • Github
  • Runbot
  • Переклади
Послуги
  • Хостинг Odoo.sh
  • Підтримка
  • Оновлення
  • Кастомні доробки
  • Навчання
  • Знайдіть бухгалтера
  • Знайдіть партнера
  • Стати партнером
Про нас
  • Наша компанія
  • Торгові активи
  • Зв'яжіться з нами
  • Вакансії
  • Події
  • Подкаст
  • Блог
  • Клієнти
  • Юридичні документи • Конфіденційність
  • Безпека
الْعَرَبيّة 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 - це набір програм для роботи з відкритим кодом, які охоплюють всі ваші потреби компанії: CRM, електронна комерція, бухгалтерський облік, склад, точка продажу, управління проектами тощо.

Унікальна пропозиція Odoo - це одночасно дуже проста у використанні та повністю інтегрована.

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