From 0232709414999e403d6c02ee5bd214130c8ac912 Mon Sep 17 00:00:00 2001 From: csil300 Date: Thu, 9 Feb 2023 16:18:05 -0700 Subject: [PATCH] [14.0][FIX] advance_check_void: modify if statement pre-commit --- advance_check_void/models/account_payment.py | 11 ++++++++--- advance_check_void/wizard/simple_void_check.py | 1 - 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/advance_check_void/models/account_payment.py b/advance_check_void/models/account_payment.py index 6061c3894..4d6a7160e 100644 --- a/advance_check_void/models/account_payment.py +++ b/advance_check_void/models/account_payment.py @@ -125,7 +125,6 @@ def void_check_button(self): } def write(self, vals): - #import pdb; pdb.set_trace() if vals.get("check_number") and not str(vals.get("check_number")).isdigit(): raise ValidationError(_("Check number must be integer.")) result = super(AccountPayment, self).write(vals) @@ -145,7 +144,7 @@ def write(self, vals): "create_date": fields.Datetime.now(), "write_date": fields.Datetime.now(), "create_uid": res.create_uid.id, - #"state": res.state, + # "state": res.state, "state": "sent", "is_visible_check": not res.check_number, } @@ -167,7 +166,13 @@ def write(self, vals): # ) if check_ids: for chk in check_ids: - if res.state != "sent": + if res.state == "posted": + chk.write({"state": "sent"}) + elif res.state == "draft": + chk.write({"state": "draft"}) + elif res.state == "cancelled": + chk.write({"state": "cancelled"}) + else: chk.write({"state": "void"}) return result diff --git a/advance_check_void/wizard/simple_void_check.py b/advance_check_void/wizard/simple_void_check.py index adfb5fd01..e5ba60ab1 100644 --- a/advance_check_void/wizard/simple_void_check.py +++ b/advance_check_void/wizard/simple_void_check.py @@ -37,4 +37,3 @@ def simple_void_check(self): self.payment_id.action_unmark_sent() if check_ids: check_ids.write({"state": "void"}) -