Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
1 Responder
265 Visualizações

Hi,

I tried overriding activity_update in hr.expense.sheet to prevent notifications:

class HrExpenseSheet(models.Model):

    _inherit = "hr.expense.sheet"

    def activity_update(self):
        records = self.filtered(lambda r: r.state not in ['draft', 'submit', 'approve', 'post', 'done'])
        if records:
            super(HrExpenseSheet, records).activity_update()

But Odoo still sends an email to the manager when the expense sheet state changes. Which method is actually responsible for these notifications, and how can i disable this feature?


Thanks! 

Avatar
Cancelar
Melhor resposta

Hi,

Please update your code like this,

class HrExpenseSheet(models.Model):

    _inherit = "hr.expense.sheet"

    def activity_update(self):

        records = self.filtered(lambda r: r.state not in ['draft', 'submit', 'approve', 'post', 'done'])

        if not records:

            return

        super(HrExpenseSheet, records).activity_update()


Hope it helps.

Avatar
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
0
fev. 23
3287
2
set. 20
5426
1
fev. 19
2916
0
mar. 15
4425
2
mar. 15
7570