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

Trouble getting correct button reference in custom module

Abonnieren

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

Diese Frage wurde gekennzeichnet
inheritancebutton
1 Antworten
5717 Ansichten
Avatar
Ben Olsen

I'm trying to use a custom module to customize various aspects of the interface, and can't seem to get the reference to a particular button correct. With the "stock" addon installed, the product "Inventory" tab has a section for "Stock and Expected Variations." I can see in the source code that this is added in the file "addons/stock/product_view.xml".

In this view, next to the "Quantity on Hand" (name="qty_available") field, there is a text button called "update" that lets users manually set the quantity available of that product. For our business, we don't want to allow that, so I thought a simple solution would be to hide the "update" button. In the source code, the button has attribute name="%(action_view_change_product_quantity)d", but in my custom module, I can't seem to refer to it with that name.

In my code, when I try to do:

<button name="%(action_view_change_product_quantity)d" position="replace" />

I get an error:

ValueError: No such external ID currently defined in the system: ui_customizations.action_view_change_product_quantity

My module is called ui_customizations, and in my __openerp__.py file I have:

"depends" : ['base', "product", "account", "stock"],

So it should be able to inherit correctly from the stock module. However no matter what I do, I can't seem to hide that update button. Here's my full code from the record level:

    <record id="my_procurement_locations_form" model="ir.ui.view">
        <field name="name">my.product.normal.procurement.locations.inherit</field>
        <field name="model">product.product</field>
        <field name="inherit_id" ref="product.product_normal_form_view"/>
        <field name="arch" type="xml">
            <button name="%(action_view_change_product_quantity)d" position="replace" />
        </field>
    </record>

Anybody have any idea what I'm doing wrong?

-------------------------------------

Comments seem to be not working at the moment, so here's my addition. Thanks to Mertechdata for getting me going in the right direction. There are two things I was still missing after his comment. First, my inherid_id was wrong, and it needed to be:

<field name="inherit_id" ref="stock.view_normal_procurement_locations_form"/>

Second, when referencing another module's ID names, you need to prepend the ID with the module name (otherwise it only looks in the current module:

<xpath expr="//button[@name='%(stock.action_view_change_product_quantity)d']" ...

0
Avatar
Verwerfen
Avatar
Eric
Beste Antwort

You will want to reference it using xpath tags instead of a button tag like this:

    <xpath expr="//button[@name='%(action_view_change_product_quantity)d']" position="replace">

    </xpath>

 

Here is another example where you can navigate down to the elements location on xml file:

    <xpath expr="/form/header/button[@name='copy_quotation']" position="replace">                   
    </xpath>

 

You can also set the buttons invisible attribute to True like this:

    <xpath expr="//field[@name='shop_id']" position="attributes">   
        <attribute name="invisible">True</attribute>                      
    </xpath> 

 

A good tutorial using xpath can be found on this website:

http://www.w3schools.com/xpath/xpath_syntax.asp

 

0
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
View Override - Add attribute on action button
view inheritance button
Avatar
Avatar
Avatar
3
Dez. 23
3641
Can't inherit base.view_partner_form of res.partner
inheritance
Avatar
Avatar
Avatar
Avatar
Avatar
4
Feb. 25
4122
Include in inherit from JS class
inheritance
Avatar
Avatar
1
Aug. 24
2947
How to Override a method in parent class in JS Gelöst
inheritance
Avatar
Avatar
2
Nov. 24
4381
How to add a simple field to partner?
inheritance
Avatar
Avatar
Avatar
Avatar
3
Okt. 23
15725
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Herunterladen
  • Github
  • Runbot
  • Übersetzungen
Dienstleistungen
  • Odoo.sh-Hosting
  • Support
  • Upgrade
  • Individuelle Entwicklungen
  • Bildung
  • 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