Raise warning when trying to validate bulk payments not in the required state

This commit is contained in:
younes 2025-05-20 12:39:01 +01:00
parent 9b5672d9de
commit 8bb8a4fa45
1 changed files with 4 additions and 4 deletions

View File

@ -107,14 +107,14 @@ class AccountPayment(models.Model):
def action_multi_depart_manager(self):
if any(rec.payment_type == 'outbound' and rec.state != 'draft' for rec in self):
raise UserError(_("Action skipped: one or more selected outbound payments are not in the 'Draft' state."))
raise ValidationError(_("Action skipped: one or more selected outbound payments are not in the 'Draft' state."))
for rec in self.filtered(lambda r: r.payment_type == 'outbound' and r.state == 'draft'):
rec.action_depart_manager()
def action_multi_accounting_manager(self):
if any(rec.payment_type == 'outbound' and rec.state != 'depart_manager' for rec in self):
raise UserError(
raise ValidationError(
_("Action skipped: one or more selected outbound payments are not in the 'Depart Manager' state."))
for rec in self.filtered(lambda r: r.payment_type == 'outbound' and r.state == 'depart_manager'):
@ -122,7 +122,7 @@ class AccountPayment(models.Model):
def action_multi_general_manager(self):
if any(rec.payment_type == 'outbound' and rec.state != 'accounting_manager' for rec in self):
raise UserError(
raise ValidationError(
_("Action skipped: one or more selected outbound payments are not in the 'Accounting Manager' state."))
for rec in self.filtered(lambda r: r.payment_type == 'outbound' and r.state == 'accounting_manager'):
@ -130,7 +130,7 @@ class AccountPayment(models.Model):
def action_multi_post_payments(self):
if any(rec.payment_type == 'outbound' and rec.state != 'general_manager' for rec in self):
raise UserError(
raise ValidationError(
_("Action skipped: one or more selected outbound payments are not in the 'General Manager' state."))
for rec in self.filtered(lambda r: r.payment_type == 'outbound' and r.state == 'general_manager'):