Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

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

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

Confirm message dialog from Python code

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
confirmodoo8
10 Odpowiedzi
36651 Widoki
Awatar
José

Hello, I am developing a new module in Odoo 8.

I need to display a confirm message (I see that I can do this adding the confirm="confirm message" in button XML) from the Python code, in a method.

For example: I override the create method of sale.order model.  I want to check if the total of the sale is under X value. If the value > X, I display a confirm message like "Do you really confirm this sale?" and catch the button pressed for the user to decide what action I do.

Thanks!

0
Awatar
Odrzuć
Stephen Mack

So what is your question?

José
Autor

My question is, how can I display the message from Python code and how can I catch the button pressed by the user?

Sehrish

hope this will helps: https://learnopenerp.blogspot.com/2017/12/how-to-display-confirmation-display-box.html

Awatar
Bole
Najlepsza odpowiedź

Yes you can do that.. using a wizzard
This approach needs the method to be split in parts (before,during and after wizard)
Steps you need to do

1. create you custom method, make some computation/data colection
;then create a record in transient model and return wizard wiev for created record
2. in wizard display whatever user needs to make a choice
3. accoring to choice continue or cancel futrher actions...

hope it helps.... 

 

0
Awatar
Odrzuć
Awatar
Ivan
Najlepsza odpowiedź

AFAIK, this is a feature lacking in Odoo.  If you want to stop the processing forward (not a confirmation but a validation that stops the processing from moving forward) you can raise an exception.  But I am not aware of anyway to display a confirmation message that user can choose to go forward or not.  You can display a warning message using on_change (e.g. when the sale order line is changed, trap it using on_change, then calculate the total sales value and if it is more than X, then display a warning message).

0
Awatar
Odrzuć
Awatar
José
Autor Najlepsza odpowiedź

Bole: I have created the method, and the wizard (py and xml files). How can I display the wizard message and catch the result from Python code?

Ivan: the warning message not helps me because this stops the execution of the method.

0
Awatar
Odrzuć
Sudhir Arya (ERP Harbor Consulting Services)

You cannot return an action/wizard from `create` method. So this won't work.

Awatar
Sehrish
Najlepsza odpowiedź

How to add or display confirmation display box / message box on button click. Before going into deep we need to know problem statement. In some scenario we need to ask from user is he/she want to do further processing or not on button click.

For example we have some document which needs to be approved by vice chancellor of a university. And before submitting it to the vice chancellor we want to ask confirmation from user.

Models.py

# Confirmation msg box for ORIC
from openerp.osv import fields,osv
from openerp.tools.translate import _
class thesis_approval_message_oric(osv.osv_memory):
    _name = "thesis.approval.message.oric"
    _columns={
        'text': fields.text(),
    }
thesis_approval_message_oric() 

Xml

     <!--Wizard For Raise Apprval Messages Thesis ORIC-->
    <record id="wizard_message_form_for_oric" model="ir.ui.view">
            <field name="name">Thesis Wizard Message Approval Message ORIC</field>
            <field name="model">thesis.approval.message.oric</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Message" version="7.0">
                    <separator string="Message" colspan="6"/>
                    <field name="text" colspan="4" nolabel="1" readonly="1"  widget="html"/>                                                            
                    <newline/>
                    <separator colspan="6"/>
                    <footer>
                        <button name="btn_approve_oric" type="object" string="Yes" class="oe_highlight"/>                             
                        <button special="cancel" string="No"/>                    
                    </footer>                                    
                </form>
            </field>
    </record>  

Button click function

    @api.multi
    def btn_approve(self):
 text = """The case """+str(self.case_no)+""" will be forward to VC for further Approval. Are you want to proceed."""
 query='delete from thesis_approval_message_oric'
 self.env.cr.execute(query)
 value=self.env['thesis.approval.message.oric'].sudo().create({'text':text})
 return{
  'type':'ir.actions.act_window',
  'name':'Message',
  'res_model':'thesis.approval.message.oric',
  'view_type':'form',
  'view_mode':'form',
  'target':'new',
  # 'context':{'thesis_obj':self.id,'flag':'course Work completed'},
  'res_id':value.id                
       }  

For code understanding and description please visit: http://learnopenerp.blogspot.com/2017/12/how-to-display-confirmation-display-box.html

0
Awatar
Odrzuć
Sehrish

Confirm message dialog from Python code: http://learnopenerp.blogspot.com/2017/12/how-to-display-confirmation-display-box.html

Awatar
CARLOS ALBERTO GARCIA BRIZUELA
Najlepsza odpowiedź

You could use the confirm attribute of buttons:

<button name="action_button_confirm" states="draft" string="Confirm Sale"  type="object" groups="base.group_user" confirm="Do you confirm this sale?"/>

0
Awatar
Odrzuć
Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Powiązane posty Odpowiedzi Widoki Czynność
Selecting items for one2many relation Rozwiązane
odoo8
Awatar
Awatar
Awatar
2
gru 22
15707
How to upload files automatically on attachments on button click ?
odoo8
Awatar
Awatar
1
lis 21
5800
Field company_registry missing in partner table
odoo8
Awatar
0
sty 21
3017
How I disable Import Button for certain model in odoo8? Rozwiązane
odoo8
Awatar
Awatar
Awatar
Awatar
Awatar
8
maj 20
8751
why blank page with top menu only visible after login? odoo 8
odoo8
Awatar
0
gru 23
3563
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة 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 to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

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