تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
7544 أدوات العرض

Hi

I need to create a smart-button with changes the state of the calendar.event and the background of the button changes depending on that state..
i've tried something like:

def _get_show_as_color(self):
    if 'show_as' == 'free':
    self.show_as_color = '#d7f1dc'
    elif 'show_as' == 'busy':
    self.show_as_color = '#f7b5b5'
    elif 'show_as' == 'confirmed':
    self.show_as_color = '#90f9c3'
    elif 'show_as' == 'cancelled':
    self.show_as_color = '#f57e7e'

show_as_color = fields.Char('Color Index', compute="_get_show_as_color")

and in xml:

<button class="oe_stat_button" type="action"
name="%(action_change_appointment_state)d" icon="fa-dot-circle-o"
style="background-color:{'show_as_color'}">
<div class="o_stat_info">
<span class="o_stat_text">Change State</span>
</div>
</button>


But this doens't work.. I dont' know if it's doable! Can anyone help me?


الصورة الرمزية
إهمال

specified odoo version, please

hi, have you found any solution for this?

أفضل إجابة

Hi, have you found answer? I also need similar functionality.

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
2
مايو 25
7877
4
يونيو 25
47266
2
نوفمبر 23
3496
2
ديسمبر 23
12905
3
يوليو 22
23304