Skip to content

Commit

Permalink
fix: changes as per review
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanket322 committed Apr 23, 2024
1 parent 0684ea0 commit 107281e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1037,26 +1037,6 @@ def get(self, purchase_names: list = None, inward_supply_names: list = None):

self.process_data(reconciliation_data, retain_doc=retain_doc)

periods = BaseUtil._get_periods(
self.inward_supply_from_date, self.inward_supply_to_date
)

purchase_invoices = frappe.get_all(
"GST Inward Supply",
filters={
"action": "No Action",
"link_name": ["!=", ""],
"sup_return_period": ["in", periods],
},
pluck="link_name",
)
frappe.db.set_value(
"Purchase Invoice",
{"name": ("in", purchase_invoices)},
"reconciliation_status",
"Match Found",
)

return reconciliation_data

def get_all_inward_supply(
Expand Down Expand Up @@ -1157,20 +1137,38 @@ def process_data(self, reconciliation_data: list, retain_doc: bool = False):
"classification": "",
}

match_found = []

for data in reconciliation_data:
data.update(default_dict)
method = data.get if retain_doc else data.pop

purchase = method("_purchase_invoice", frappe._dict())
inward_supply = method("_inward_supply", frappe._dict())

if (
inward_supply
and purchase
and inward_supply.get("action") == "No Action"
and inward_supply.get("link_name") != ""
):
match_found.append(purchase.get("name"))

self.update_fields(data, purchase, inward_supply)
self.update_amount_difference(data, purchase, inward_supply)
self.update_differences(data, purchase, inward_supply)

if retain_doc and purchase:
BaseUtil.update_cess_amount(purchase)

for doc in ("Purchase Invoice", "Bill of Entry"):
frappe.db.set_value(
doc,
{"name": ("in", match_found)},
"reconciliation_status",
"Match Found",
)

def update_fields(self, data, purchase, inward_supply):
for field in ("supplier_name", "supplier_gstin", "bill_no", "bill_date"):
data[field] = purchase.get(field) or inward_supply.get(field)
Expand Down
2 changes: 1 addition & 1 deletion india_compliance/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ india_compliance.patches.post_install.update_gst_treatment_for_taxable_nil_trans
india_compliance.patches.post_install.update_default_gstr3b_status
india_compliance.patches.v14.update_gst_details_for_invoices_with_same_item_multiple_times
india_compliance.patches.v14.update_e_invoice_status
india_compliance.patches.v14.add_match_found_in_purchase_reconciliation_status
execute:from erpnext.stock.doctype.repost_item_valuation.repost_item_valuation import execute_repost_item_valuation; execute_repost_item_valuation()
india_compliance.patches.v14.set_item_details_from_purchase_invoice_to_bill_of_entry
india_compliance.patches.v14.update_item_gst_details_and_gst_trearment_in_bill_of_entry
india_compliance.patches.v14.update_default_auto_reconciliation_settings
india_compliance.patches.v14.add_match_found_in_purchase_reconciliation_status
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@


def execute():
purchase_invoices = frappe.get_all(
pi_and_boe_list = frappe.get_all(
"GST Inward Supply",
filters={"action": "No Action", "link_name": ["!=", ""]},
filters={"action": "No Action", "link_name": ("!=", "")},
pluck="link_name",
)
frappe.db.set_value(
"Purchase Invoice",
{"name": ("in", purchase_invoices)},
"reconciliation_status",
"Match Found",
)
if pi_and_boe_list:
for doc in ("Purchase Invoice", "Bill of Entry"):
frappe.db.set_value(
doc,
{"name": ("in", pi_and_boe_list)},
"reconciliation_status",
"Match Found",
)

0 comments on commit 107281e

Please sign in to comment.