Skip to content

Commit

Permalink
fix: set value in one query
Browse files Browse the repository at this point in the history
  • Loading branch information
vorasmit committed Apr 18, 2024
1 parent a4ff9ac commit 3e7ba59
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,19 @@ def on_cancel(self):
self.ignore_linked_doctypes = ("GL Entry",)
make_reverse_gl_entries(voucher_type=self.doctype, voucher_no=self.name)

if self.reconciliation_status == "Reconciled":
doc_name = frappe.get_value("GST Inward Supply", {"link_name": self.name})
updated_data = {
if self.reconciliation_status != "Reconciled":
return

frappe.db.set_value(
"GST Inward Supply",
{"link_doctype": "Bill of Entry", "link_name": self.name},
{
"match_status": "",
"link_name": "",
"link_doctype": "",
"action": "No Action",
}
frappe.db.set_value("GST Inward Supply", doc_name, updated_data)
},
)

# Code adapted from AccountsController.on_trash
def on_trash(self):
Expand Down
14 changes: 9 additions & 5 deletions india_compliance/gst_india/overrides/purchase_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,19 @@ def validate(doc, method=None):


def on_cancel(doc, method=None):
if doc.reconciliation_status == "Reconciled":
doc_name = frappe.get_value("GST Inward Supply", {"link_name": doc.name})
updated_data = {
if doc.reconciliation_status != "Reconciled":
return

frappe.db.set_value(
"GST Inward Supply",
{"link_doctype": "Purchase Invoice", "link_name": doc.name},
{
"match_status": "",
"link_name": "",
"link_doctype": "",
"action": "No Action",
}
frappe.db.set_value("GST Inward Supply", doc_name, updated_data)
},
)


def set_reconciliation_status(doc):
Expand Down

0 comments on commit 3e7ba59

Please sign in to comment.