Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Social media Marketing
    • E-mailmarketing
    • SMS Marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for Partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help

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

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

Return wizard from a function

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
5838 Weergaven
Avatar
Celia

How can I call a wizard in a return of a function? 

This is the first wizard that appears: 

class get_ticket(osv.osv_memory):    
    _name = 'get.tickets.wizard'    

    def _tickets_control(self, cr, uid, context=None):         active_ids = []         partner_ids = {}         for active_id in context.get('active_ids'):             active_ids.append(active_id)             for partner_id in self.pool.get('tickets').browse(cr, uid, active_id, context=context).partner_id:                 partner_ids[partner_id.id] = partner_id.id         if len(active_ids) <= 1:             self.display_error_message(cr, uid, 'You have to select more than 1 tickets.')             return False          elif len(partner_ids) > 1:             self.display_error_message(cr, uid, 'You have selected 2 or more tickets of different partners.')             return False         return True
    
    def display_error_message(self, cr, uid, error, context=None):         view_id = self.pool.get('ir.model.data').get(cr, uid, 'get_ticket_wizard', 'close_wizard_form_view', context=context)         view_id = view_id[0]         return {             'name': _("Error"),             'view_type': 'form',             'view_mode': 'form',             'view_id': view_id,             'res_model': 'close.wizard',             'type': 'ir.actions.act_window',             'target': 'new',             'context': {'error': error},     }     _columns = {         'ticket_id': fields.many2one('tickets', string='Ticket to keep'),         'control': fields.boolean(compute='_tickets_control'),     }     def onchange_get_tickets(self, cr, uid, ids, context=None):         active_ids = []         for active_id in context.get('active_ids'):             active_ids.append(active_id)         return {'domain': {'ticket_id': [('id', 'in', active_ids)]}}     _defaults = {         'control': _tickets_control,     }

And this is the wizard that I want to call (that has the function like an error message and close the wizard before and this [this I don't know if really does it]): 

class close_wizard(osv.osv_memory):    
    _name = 'close.wizard'    

    def _display_error(self, cr, uid, ids, context=None):        
        return context.get('error')    

    def _close_window_wizard(self, cr, uid, ids, context=None):         return {'type': 'ir.actions.act_window_close'}     _columns = {         'error': fields.char(string=''),     }     _defaults = {         'error': _display_error,     }

And this is its view: 

<!-- ********** Form view of close wizard ********** -->
<record model="ir.ui.view" id="close_wizard_form_view">    
    <field name="name">close.wizard.form</field>    
    <field name="model">close.wizard</field>    
    <field name="arch" type="xml">        
        <form string="Error">            
            <group>                
                <field name="error"/>            
            </group>            
            <footer>                
                <button string="Accept" name="%(_close_wizard_window)d" type="action" class="oe_highlight"/>         
            </footer>        
        </form>    
    </field>
</record>
<!-- ********** Option get tickets in menu 'More' ********** -->
<act_window id="close_wizard_action"            
    multi="True"            
    key2="client_action_multi"            
    name="Error"            
    res_model="close.wizard"            
    src_model="get.tickets.wizard"            
    view_mode="form"            
    target="new"            
    view_type="form"/>


0
Avatar
Annuleer
Emipro Technologies Pvt. Ltd.

Can you explain your main objective to achieve from wizard ? It will help us to understand your code as well as your requirement. Based on that we can give you exact suggestion or solution.

Celia
Auteur

The module that I'm developing has the objective to have tickets as part of after-sales services. That tickets can being fused or separated in 2 tickets and other actions. Here I'm going to fuse 2 tickets, to do this I have to check 2 tickets in the tree view and in the 'more' button I have an option 'Fuse tickets' that call the wizard (get.tickets.wizard), here appears the wizard that has a many2one where I have to select the ticket that I want to preserve (the other is going to go over to another status, that is fused), but if the tickets that I have checked are of differents partners I have to display a message with the error, and I have to close the message error and the wizard when the user press the 'accept' button. So in code is: I call _tickets_control function, and if is something wrong (like the tickets have differents partners), this function calls display_error_message function that has to return the error message wizard (or window or view)

Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Word een Partner
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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