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
    • Discuss
    • 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

how to make the "mark done" disappear depending on a condition

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
5 Replies
2334 Tampilan
Avatar
Aws Hokan

How to change the XML code so that if the signed in user is the assignee user in a certain activity then the "mark done" button should appear to the mentioned user, if the signed in user NOT the assignee user the "mark done" button disappear.
the Activity.xml file that I think should change


0
Avatar
Buang
Aws Hokan
Penulis

Thanks Jason for response but i tried as you suggest but not working. the code appear as the following :
<button class="o_Activity_toolButton o_Activity_markDoneButton btn btn-link btn-primary pt-0 ps-0"
t-att-title="activityView.markDoneText" t-ref="markDoneButton" t-on-click="activityView.onClickMarkDoneButton" attrs="{'invisible': [('user_id', '!=', uid)]}"
>
<i class="fa fa-check"/> Mark Done
</button>

Aws Hokan
Penulis

Thank you all for replay. I tried the mentioned solution but still face the same result.
I think that the condition is true but the parameters are false ( the assignee Id and the singed in user id)

Avatar
Jason Vu
Jawaban Terbai

Hi,

you can try to add this to your button: 

attrs="{'invisible': [('user_id', '!=', uid)]}"

Hope it helps!

1
Avatar
Buang
Avatar
Osama Hassan
Jawaban Terbai

Hello aws hokan, Jason Vu provided sample code for such operation as you didn't provide you code snippet earlier.
Try this

attrs="{'invisible': [('activity_assignee_id', '!=', uid)]}"

upgrade module and clear browser cache as sometimes the cache prevents from changes made in xml/js file.


1
Avatar
Buang
Avatar
Jainesh Shah(Aktiv Software)
Jawaban Terbai

Hello Aws Hokan, 


We can achieve this by defining a new Boolean field and we have to compute it's value based on our condition. Now, We'll use this field in the attrs of the "mark done" button. 

Please find code in comment.

Kindly let us know if you face any issue.

Hope it will be helpful to you.

Thanks & Regards,
Email:   odoo@aktivsoftware.com  

Skype: kalpeshmaheshwari

0
Avatar
Buang
Jainesh Shah(Aktiv Software)

Please find code here :-

You can use below code.

# python code:

from odoo import api, fields, models

class MailActivity(models.Model):
_inherit = "mail.activity"

display_mark_done = fields.Boolean(compute="_compute_display_mark_done")
@api.depends("user_id")
def _compute_display_mark_done(self):
for rec in self:
rec.display_mark_done = self.env.user.id == rec.user_id.id

<!--xml code:-->
<!--We'll user 'display_mark_done' field in the attrs of 'mark as done' button like below.-->
<!--please make sure that the priority is set to 100 so that other views can't override our view.-->

<?xml version="1.0" encoding="UTF-8" ?>

<odoo>
<record id="mail_activity_view_form_popup_inherited" model="ir.ui.view">
<field name="name">mail.activity</field>
<field name="model">mail.activity</field>
<field name="priority" eval="100"/>
<field name="inherit_id" ref="mail.mail_activity_view_form_popup"/>
<field name="arch" type="xml">
<xpath expr="//button[@name='action_done']" position="attributes">
<!--other domains are coming from base view and we don't want to override it-->
<attribute name="attrs">
{'invisible': ['|', '|',
('display_mark_done', '=', False),
('activity_category', 'in', ['meeting', 'tax_report']),
('chaining_type', '=', 'trigger')]}
</attribute>
</xpath>
</field>
</record>
</odoo>

Avatar
Nimisha Muralidhar
Jawaban Terbai

Hi

You will need to add a condition to the visibility of the button based on the current user's role as the assignee. Use the attrs attribute to define the condition.

Thank You

-1
Avatar
Buang
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Jawaban Terbai

Hi 

Please try the code given below,

<button name="action_mark_done" string="Mark Done" type="object"
        attrs="{'invisible': [('user_id', '!=', uid)]}"/>

Hope it helps

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

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

Daftar
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