Skip to content

Commit

Permalink
[14.0][FIX] advance_check_void: modify if statement
Browse files Browse the repository at this point in the history
pre-commit
  • Loading branch information
csil300 authored and patrickrwilson committed Feb 27, 2023
1 parent d17e802 commit 0232709
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 8 additions & 3 deletions advance_check_void/models/account_payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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,
}
Expand All @@ -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

Expand Down
1 change: 0 additions & 1 deletion advance_check_void/wizard/simple_void_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,3 @@ def simple_void_check(self):
self.payment_id.action_unmark_sent()
if check_ids:
check_ids.write({"state": "void"})

0 comments on commit 0232709

Please sign in to comment.