Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][FIX] advance_check_void: handle void check button #524

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions advance_check_void/models/account_payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,12 @@ 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,
}
new_chk = check_hist_obj.create(check_hist)
check_ids = False
if new_chk:
check_ids = check_hist_obj.search(
[
Expand All @@ -157,14 +159,20 @@ def write(self, vals):
],
limit=1,
)
else:
check_ids = check_hist_obj.search(
[("payment_id", "=", res.id), ("write_date", "<=", res.write_date)],
limit=1,
)
# else:
# check_ids = check_hist_obj.search(
# [("payment_id", "=", res.id), ("write_date", "<=", res.write_date)],
# limit=1,
# )
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
4 changes: 2 additions & 2 deletions advance_check_void/wizard/simple_void_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ def simple_void_check(self):
order="id desc",
limit=1,
)
if check_ids:
check_ids.write({"state": "posted"})
self.payment_id.action_unmark_sent()
if check_ids:
check_ids.write({"state": "void"})