From 398c126cfaafcd2782d553475fadcb6f21f6fffd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 2 Jan 2018 14:49:46 +0100 Subject: [PATCH] [IMP] account: display access buttons in notification email only on not draft not canceled invoices Indeed draft and canceled invoices should not be displayed to customer or portal customers. --- addons/account/models/account_invoice.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index a3aadfe7fa7..164f79bfa2a 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -875,10 +875,11 @@ class AccountInvoice(models.Model): def _notification_recipients(self, message, groups): groups = super(AccountInvoice, self)._notification_recipients(message, groups) - for group_name, group_method, group_data in groups: - if group_name == 'customer': - continue - group_data['has_button_access'] = True + if self.state not in ('draft', 'cancel'): + for group_name, group_method, group_data in groups: + if group_name == 'customer': + continue + group_data['has_button_access'] = True return groups