Skip to content

Commit

Permalink
fix: show reconciliaiton status in invoice (resilient-tech#1116)
Browse files Browse the repository at this point in the history
  • Loading branch information
ljain112 authored Oct 10, 2023
1 parent 1496d70 commit eda4629
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
2 changes: 2 additions & 0 deletions india_compliance/gst_india/client_scripts/purchase_invoice.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ frappe.ui.form.on(DOCTYPE, {
},

refresh(frm) {
india_compliance.set_reconciliation_status(frm, "bill_no");

if (
frm.doc.docstatus !== 1 ||
frm.doc.gst_category !== "Overseas" ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ frappe.ui.form.on("Bill of Entry", {
},

refresh(frm) {
india_compliance.set_reconciliation_status(frm, "bill_of_entry_no");

if (frm.doc.docstatus === 0) return;

// check if Journal Entry exists;
Expand Down
24 changes: 23 additions & 1 deletion india_compliance/public/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ Object.assign(india_compliance, {

refresh_btn.on("click", async function () {
const force_update = 1;
await india_compliance.set_gstin_status(field, transaction_date, force_update);
await india_compliance.set_gstin_status(
field,
transaction_date,
force_update
);
});
},

Expand Down Expand Up @@ -195,6 +199,24 @@ Object.assign(india_compliance, {
};
};
},

set_reconciliation_status(frm, field) {
if (!frm.doc.docstatus === 1 || !frm.doc.reconciliation_status) return;

const STATUS_COLORS = {
Reconciled: "green",
Unreconciled: "red",
Ignored: "grey",
"Not Applicable": "grey",
};
const color = STATUS_COLORS[frm.doc.reconciliation_status];

frm.get_field(field).set_description(
`<div class="d-flex indicator ${color}">
Reco Status:&nbsp;<strong>${frm.doc.reconciliation_status}</strong>
</div>`
);
},
});

function is_gstin_check_digit_valid(gstin) {
Expand Down

0 comments on commit eda4629

Please sign in to comment.