Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
3055 Vizualizări

Hi,

I created smart button to count messages from object x,

messages_count = fields.Integer(string='Messages', compute='_compute_messages_count')
def _compute_messages_count(self):
        for record in self:
            record.messages_count = self.env['x'].search_count(
                [('ticket_id', '=', self.id)])

this object x gets messages by http request.

x = request.env['x'].sudo()
x.create({
            'body': message,
            'ticket_id':ticket_id
            }) 


My problem is smart button does not display the counter of the messages that accessed to object x immediately, I should first refresh the web page to display the counter with new value, but I want to display the counter immediately without refresh the web page.


Is there a way to solve this problem?


note: I use message_post() function to log message in odoo chatter and work fine data message come without refresh the web page

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
4
mai 21
28960
2
nov. 23
8921
1
iun. 23
2475
3
feb. 22
11164
1
mai 21
4890