Zum Inhalt springen
Odoo Menü
  • Anmelden
  • Jetzt gratis testen
  • Apps
    Finanzen
    • Buchhaltung
    • Rechnungsstellung
    • Spesenabrechnung
    • Tabellenkalkulation (BI)
    • Dokumente
    • E-Signatur
    Vertrieb
    • CRM
    • Vertrieb
    • Kassensystem – Shop
    • Kassensystem – Restaurant
    • Abonnements
    • Vermietung
    Websites
    • Website-Builder
    • E-Commerce
    • Blog
    • Forum
    • Livechat
    • E-Learning
    Lieferkette
    • Lager
    • Fertigung
    • PLM
    • Einkauf
    • Wartung
    • Qualität
    Personalwesen
    • Mitarbeiter
    • Personalbeschaffung
    • Abwesenheiten
    • Mitarbeiterbeurteilung
    • Personalempfehlungen
    • Fuhrpark
    Marketing
    • Social Marketing
    • E-Mail-Marketing
    • SMS-Marketing
    • Veranstaltungen
    • Marketing-Automatisierung
    • Umfragen
    Dienstleistungen
    • Projekte
    • Zeiterfassung
    • Außendienst
    • Kundendienst
    • Planung
    • Termine
    Produktivität
    • Dialog
    • Genehmigungen
    • IoT
    • VoIP
    • Wissensdatenbank
    • WhatsApp
    Apps von Drittanbietern Odoo Studio Odoo Cloud-Plattform
  • Branchen
    Einzelhandel
    • Buchladen
    • Kleidergeschäft
    • Möbelhaus
    • Lebensmittelgeschäft
    • Baumarkt
    • Spielwarengeschäft
    Essen & Gastgewerbe
    • Bar und Kneipe
    • Restaurant
    • Fast Food
    • Gästehaus
    • Getränkehändler
    • Hotel
    Immobilien
    • Immobilienagentur
    • Architekturbüro
    • Baugewerbe
    • Immobilienverwaltung
    • Gartenarbeit
    • Eigentümervereinigung
    Beratung
    • Buchhaltungsfirma
    • Odoo-Partner
    • Marketingagentur
    • Anwaltskanzlei
    • Talentakquise
    • Prüfung & Zertifizierung
    Fertigung
    • Textil
    • Metall
    • Möbel
    • Speisen
    • Brauerei
    • Firmengeschenke
    Gesundheit & Fitness
    • Sportklub
    • Brillengeschäft
    • Fitnessstudio
    • Therapeut
    • Apotheke
    • Friseursalon
    Handel
    • Handyman
    • IT-Hardware & -Support
    • Solarenergiesysteme
    • Schuster
    • Reinigungsdienstleistungen
    • HLK-Dienstleistungen
    Sonstiges
    • Gemeinnützige Organisation
    • Umweltschutzagentur
    • Plakatwandvermietung
    • Fotostudio
    • Fahrrad-Leasing
    • Software-Händler
    Alle Branchen ansehen
  • Community
    Lernen
    • Tutorials
    • Dokumentation
    • Zertifizierungen
    • Schulung
    • Blog
    • Podcast
    Bildung fördern
    • Bildungsprogramm
    • Scale-Up! Planspiel
    • Odoo besuchen
    Software anfragen
    • Herunterladen
    • Editionen vergleichen
    • Releases
    Zusammenarbeiten
    • Github
    • Forum
    • Veranstaltungen
    • Übersetzungen
    • Partner werden
    • Dienstleistungen für Partner
    • Buchhaltungsfirma registrieren
    Services anfragen
    • Partner finden
    • Buchhalter finden
    • Einen Experten treffen
    • Implementierungsservices
    • Kundenreferenzen
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Eine Demo erhalten
  • Preiskalkulation
  • Hilfe

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

  • CRM
  • e-Commerce
  • Buchhaltung
  • Lager
  • PoS
  • Projekte
  • MRP
All apps
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Hilfe

How to pass context from wizard to view and to and other action after?

Abonnieren

Erhalten Sie eine Benachrichtigung, wenn es eine Aktivität zu diesem Beitrag gibt

Diese Frage wurde gekennzeichnet
actionwizardviewcontextpass
2 Antworten
45550 Ansichten
Avatar
Pascal Tremblay

Hello all,

I have a new wizard who run well. This wizard allow user to choose a category.

When the user confirms the wizard, a new board.board view is started with the value of the choosen category in the context. Many graphs will be on this board according to the choosen category.

When the board.board view receive the context, how can it pass the context to the first graph action?

After this, how could the graph action use this context in its own domain?

I have a new field on stock.quant model (product_categ_id) and I want the first graph of my board only has quants with the category choosen by the user in the wizard.

Could you help please?


The wizard python (context has the choosen category in it) :

class wizard_choose_category(models.TransientModel):
    _name = 'wizard.choose.category'
    _description = 'Wizard that allow to choose a category'
    choose_category = fields.Many2one('product.category', string='Product category', domain=[('parent_id','!=', 1)])        #date = fields.Datetime('Date', default=fields.Datetime.now, required=True)        @api.multi    def open_table(self):
        self.ensure_one()
        ctx = dict(
            self._context,
            category=self.choose_category.id
            )
            
            res = {
            'domain': "[]",           
                'name': _('My dashboard by category'),
                'view_type': 'form',
                'view_mode': 'form',
                'res_model': 'board.board',
                'type': 'ir.actions.act_window',
                'context': ctx,
                'view_id': self.env.ref('vtm2_cavavin_inventory_graphs.inventory_by_category_form').id,
                'target': 'current',
            }

The view of boards (how to pass the received context to the called action?) :

<record id="inventory_by_category_form" model="ir.ui.view">
    <field name="name">Inventory dashboard form</field>
    <field name="model">board.board</field>
    <field name="arch" type="xml">
      <form string="Inventory dashboard">
            <board style="1-0">
                <column>
                    <action context="get.context()" string="Inventory pivot table"
                        name="%(action_inventory_pivot_1)d" />
                            
                </column>
            </board>
        </form>
    </field>
</record>


The action of the first graph (how to use the received context in the domain?) :

<record id="action_inventory_pivot_1" model="ir.actions.act_window">
            <field name="name">My inventory pivot #1</field>
            <field name="res_model">stock.quant</field>
            <field name="view_type">form</field>
            <field name="view_mode">graph</field>
            <field name="domain">[]</field>
            <field name="view_id" ref="inventory_pivot_1" />
        </record>


EDIT #1

I was certain that this line would work... But it is not the case...

<action string="Inventory of your choosen category - pivot table" name="%(action_inventory_pivot_1)d" 
    context="{'category': context.get('category')}" />



EDIT #2

With this line, all works fine. My graph displays all the quant from de category = 9. So the action tag of in a board view can pass the context to the called action. But the context.get() method doesn't seem to work in it...

<action string="Inventory of your choosen category - pivot table" name="%(action_inventory_pivot_1)d"
     context="{'category': 9}" />
4
Avatar
Verwerfen
Sehrish

How to to use context: http://learnopenerp.blogspot.com/2018/01/get-parent-form-value-in-one2many-form.html

Avatar
Pascal Tremblay
Autor Beste Antwort

Here is our solution.


The action of the first graph (with the new domain who uses the context value) :

<record id="action_inventory_pivot_1" model="ir.actions.act_window">
            <field name="name">My inventory pivot #1</field>
            <field name="res_model">stock.quant</field>
            <field name="view_type">form</field>
            <field name="view_mode">graph</field>
            <field name="domain">[('product_category_id','=',context.get('category'))]</field>
            <field name="view_id" ref="inventory_pivot_1" />
        </record>


And we use Python to override the context of the board.board action because it doesn't want to understand context.get() method.

from lxml import etree

class board_board(osv.osv):
    _inherit = 'board.board'
    def fields_view_get(self, cr, user, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):

        result = super(board_board,self).fields_view_get(cr, user, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
       
        doc = etree.XML(result['arch'])
       
        for node in doc.xpath("//action"):
            set_context = "{'choosen_category': %s}" % context.get('category')
            node.set("context", set_context)
                result["arch"] = etree.tostring(doc)
        
        return result




3
Avatar
Verwerfen
Diskutieren Sie gerne? Treten Sie bei, statt nur zu lesen!

Erstellen Sie heute ein Konto, um exklusive Funktionen zu nutzen und mit unserer tollen Community zu interagieren!

Registrieren
Verknüpfte Beiträge Antworten Ansichten Aktivität
How to disable wizard call in specific views ?
action wizard view
Avatar
0
März 15
4665
How to pass context to a called action with kanban view links or buttons? Gelöst
action view kanban context
Avatar
Avatar
1
Okt. 21
19266
Triggering an action from a function?
action function wizard trigger view
Avatar
Avatar
Avatar
2
März 15
12653
How to use the previous context in the action definition? Gelöst
action context
Avatar
Avatar
1
Apr. 25
4372
Problem with opening full composer in send message
action wizard
Avatar
0
Jan. 25
1996
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Herunterladen
  • Github
  • Runbot
  • Übersetzungen
Dienstleistungen
  • Odoo.sh-Hosting
  • Support
  • Upgrade
  • Individuelle Entwicklungen
  • Ausbildung
  • Buchhalter finden
  • Partner finden
  • Partner werden
Über uns
  • Unsere Firma
  • Markenwerte
  • Kontakt
  • Karriere
  • Veranstaltungen
  • Podcast
  • Blog
  • Kunden
  • Rechtliches • Datenschutz
  • Sicherheit
الْعَرَبيّة 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 ist eine Suite von Open-Source-Betriebsanwendungen, die alle Bedürfnisse Ihres Unternehmens abdecken: CRM, E-Commerce, Buchhaltung, Lager, Kassensystem, Projektmanagement etc.

Das einzigartige Wertversprechen von Odoo ist, dass es gleichzeitig sehr einfach zu bedienen und voll integriert ist.

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