Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Rantai Pasokan
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Diskusi
    • Approval
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri-Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Estate Management
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Temui penasihat
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan

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

  • CRM
  • e-Commerce
  • Akuntansi
  • Inventaris
  • PoS
  • Project
  • MRP
All apps
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

Hiding buttons depending on state or value?

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
hidestatebuttons
3 Replies
22719 Tampilan
Avatar
mike

I have implemented an audit feature for stock moves using a wizard. The shipments and moves are flagged for auditing depending on certain criteria and the flagged moves display buttons for the wizard. The stock.move model has new Boolean fields for audit flag and audit_fail. When audit flag is set True the Audit button is displayed in form and tree views. When audit_fail is set True then its corresponding button is displayed. However I need to hide audit flag when state is done and this is not happening. Refer to code.

<!-- Stock Move Form (inherit)-->
        <record id="stock_move_form_inherit" model="ir.ui.view">
            <field name="name">stock.move.form.inherit</field>
            <field name="model">stock.move</field>
            <field name="inherit_id" ref="stock.view_move_form" />
            <field eval="5" name="priority"/>
            <field name="arch" type="xml">
                <field name="date" position="after">
                  <field name="audit" invisible="1" />
                  <field name="audit_fail" invisible="1" />
                  <field name="note" />
                </field>
                <field name="product_uom" position="after">
                  <button name="%(vmi.move_audit)d" icon="gtk-find" type="action" class="oe_highlight" string="Audit" help="Audit" attrs="{'invisible': [('audit','&lt;&gt;', True)]}" states="draft,waiting,confirmed,assigned" />
                  <button name="fail_audit" icon="gtk-dialog-warning" type="object" class="oe_highlight" string="Failed Audit" help="Failed Audit" attrs="{'invisible': [('audit_fail','&lt;&gt;', True)]}" />            
                </field>
          </field>
        </record>
<!-- Stock Move Tree (inherit)-->
        <record id="stock_move_tree2_inherit" model="ir.ui.view">
            <field name="name">stock.move.tree2.inherit</field>
            <field name="model">stock.move</field>
            <field name="inherit_id" ref="stock.view_move_tree_reception_picking" />
            <field eval="5" name="priority"/>
            <field name="arch" type="xml">
                <field name="date" position="after">
                  <field name="audit" invisible="1" />
                  <field name="audit_fail" invisible="1" />
                </field>
                <field name="product_qty" position="after">
                  <button name="%(vmi.move_audit)d" icon="gtk-find" type="action" colspan="1" help="Audit" attrs="{'invisible': [('state','=','done'),('audit','&lt;&gt;', True)]}" />
                  <button name="fail_audit" icon="gtk-dialog-warning" type="object" colspan="1" help="Failed Audit" attrs="{'invisible': [('audit_fail','&lt;&gt;', True)]}" />
                </field>
            </field>
        </record>

class vmi_stock_move(osv.osv):
    """Override of stock.move"""
    _name = 'stock.move'
    _inherit = 'stock.move'
    _columns = {
        'audit': fields.boolean('Audit'),
        'audit_fail': fields.boolean('Failed Audit'),
        }
    _defaults = {
        'audit': False,
        'audit_fail': False,
        }

I try both states attribute and attrs with domain and neither hides the button when the field is true. Only the value of the field is being used to determine display. Can I use both the field value and the state like this or is it a conflict?


You can see in screenshot where moves in Done state still have audit buttons. They should not be there when Done but the flag needs to remain set regardless. Move form with audit buttonMove tree with audit button

1
Avatar
Buang
Avatar
AJ Schrafel Paper Corp
Jawaban Terbai

You want to hide it when state is done OR audit is false?

audit is a boolean, keep it simple make it = False instead of <> True

Second add the OR | operator at the front, the default operator between tuples is AND & in this case.

['|',('state','=','done'),('audit','=', False)]
2
Avatar
Buang
mike
Penulis

Perfect. I added the OR operator and it works as desired. Now I can leave the boolean set for determining if a move was completed without the required audit being performed. Excellent! Thank you so much for the assistance!!!!

Avatar
Sehrish
Jawaban Terbai

Try this

<button name="your_button_name"  string="My Button"  type="object" class="oe_highlight" attrs="{'invisible':['|',('state','=','done'),('audit','=', False)]}"/>

1
Avatar
Buang
Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Post Terkait Replies Tampilan Aktivitas
desactiver le bouton envoyer par email pour des utilisateurs
hide buttons
Avatar
0
Sep 25
1879
button in a tree view is shown to the user that are not assigned to the user group
hide buttons usergroup
Avatar
0
Feb 23
2381
How can I hide a <button ?
hide buttons odoo8.0
Avatar
Avatar
2
Jul 16
5308
How to remove "View Delivery Order" button from confirmed sale orders for a specific user?
hide buttons remove
Avatar
Avatar
1
Mar 15
9751
Hide buttons depending on the state of a checkbox that is in res.users[SOLVED] Diselesaikan
community hide buttons odoo
Avatar
Avatar
Avatar
Avatar
3
Jun 23
5345
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Tugas
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة 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 adalah rangkaian aplikasi bisnis open source yang mencakup semua kebutuhan perusahaan Anda: CRM, eCommerce, akuntansi, inventaris, point of sale, manajemen project, dan seterusnya.

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik 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