[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.
This commit is contained in:
Thibault Delavallée
2018-02-15 14:50:36 +01:00
parent 467e490e5d
commit 398c126cfa
+5 -4
View File
@@ -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