Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged

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
Zrušit
Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
0
úno 23
3077
2
zář 20
5171
1
úno 19
2805
0
bře 15
4243
2
bře 15
7328