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

chore: release v14 #2821

Merged
merged 27 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ce8f067
chore: use `placeholder` to mask sensitive info
Abdeali099 Nov 28, 2024
85f6041
fix: auto set link doctype and docname in address dialog for lead
ljain112 Nov 27, 2024
121b250
Merge pull request #2787 from resilient-tech/mergify/bp/version-14-ho…
mergify[bot] Nov 28, 2024
ab03de5
fix: allow setting pos from shipping address based on account settings
Nov 14, 2024
aa99dfc
fix: minor UI change
Nov 14, 2024
322ad85
fix: test case
Nov 14, 2024
6aa0244
fix: support use of customer shipping address instead of company gsti…
vorasmit Nov 16, 2024
dc0a2ad
test: add additional tests for place of supply
vorasmit Nov 16, 2024
f6d52d3
chore: resolve conflicts
vorasmit Nov 28, 2024
431fa1a
Merge pull request #2793 from resilient-tech/mergify/bp/version-14-ho…
mergify[bot] Nov 28, 2024
cea5a0a
Merge pull request #2789 from resilient-tech/mergify/bp/version-14-ho…
vorasmit Nov 28, 2024
540c6d2
fix: do not check gst category for setting Place of supply
ljain112 Nov 20, 2024
fe113f8
Merge pull request #2796 from vorasmit/fic-pos
vorasmit Nov 28, 2024
2065676
fix: Take up Company type from GSTIN portal automatically (#2770)
Sanket322 Nov 28, 2024
a954e37
Merge pull request #2797 from resilient-tech/mergify/bp/version-14-ho…
vorasmit Nov 28, 2024
963c956
fix: show correct number of documents for purchase recon tool for mis…
vorasmit Nov 29, 2024
5717ccd
fix: correct option for field GST Inward Supply
vorasmit Nov 29, 2024
293a7ff
fix: better matches for CDNR by ignoring the difference in bill date
vorasmit Nov 29, 2024
4e1bac7
fix: auto suggest creation of debit note for CDNR when creating a pur…
vorasmit Nov 29, 2024
2b686ba
fix: better filters for match status and actions performed
vorasmit Nov 29, 2024
af8eb24
fix: show doctype name in detail comparision
vorasmit Nov 29, 2024
e1b7e97
fix: add filter for purchase doctype to purchase reco tool
vorasmit Nov 29, 2024
fbce97f
chore: resolve conflicts
vorasmit Dec 5, 2024
bf8038a
Merge pull request #2804 from resilient-tech/mergify/bp/version-14-ho…
mergify[bot] Dec 5, 2024
8eb246e
fix: handle `Actions` button for smaller screens (#2806)
Abdeali099 Dec 5, 2024
790db27
chore: resolve conflicts
vorasmit Dec 5, 2024
6d8f0e1
Merge pull request #2823 from resilient-tech/mergify/bp/version-14-ho…
vorasmit Dec 5, 2024
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
10 changes: 5 additions & 5 deletions india_compliance/gst_india/api_classes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ def is_ignored_error(self, response_json):
pass

def handle_http_code(self, status_code, response_json):

# GSP connectivity issues
if status_code == 401 or (
status_code == 403
Expand Down Expand Up @@ -265,22 +264,23 @@ def mask_sensitive_info(self, log):
output = log.output
data = log.data
request_body = data and data.get("body")
placeholder = "*****"

for key in self.SENSITIVE_INFO:
if key in request_headers:
request_headers[key] = "*****"
request_headers[key] = placeholder

if output and key in output:
output[key] = "*****"
output[key] = placeholder

if not data:
continue

if key in data:
data[key] = "*****"
data[key] = placeholder

if request_body and key in request_body:
request_body[key] = "*****"
request_body[key] = placeholder


def get_public_ip():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ def __init__(self, **kwargs):

def get_all(self, additional_fields=None, names=None, only_names=False):
query = self.get_query(additional_fields)
match_found = ("Reconciled", "Match Found")

if only_names and not names:
return
Expand All @@ -360,15 +361,15 @@ def get_all(self, additional_fields=None, names=None, only_names=False):
query = query.where(
(
(self.PI.posting_date[self.from_date : self.to_date])
& (IfNull(self.PI.reconciliation_status, "") != "Reconciled")
& (IfNull(self.PI.reconciliation_status, "").notin(match_found))
)
| (self.PI.name.isin(names))
)

else:
query = query.where(
(self.PI.posting_date[self.from_date : self.to_date])
& (IfNull(self.PI.reconciliation_status, "") != "Reconciled")
& (IfNull(self.PI.reconciliation_status, "").notin(match_found))
)

return query.run(as_dict=True)
Expand Down Expand Up @@ -502,6 +503,7 @@ def __init__(self, **kwargs):

def get_all(self, additional_fields=None, names=None, only_names=False):
query = self.get_query(additional_fields)
match_found = ("Reconciled", "Match Found")

if only_names and not names:
return
Expand All @@ -513,15 +515,15 @@ def get_all(self, additional_fields=None, names=None, only_names=False):
query = query.where(
(
(self.BOE.posting_date[self.from_date : self.to_date])
& (IfNull(self.BOE.reconciliation_status, "") != "Reconciled")
& (IfNull(self.BOE.reconciliation_status, "").notin(match_found))
)
| (self.BOE.name.isin(names))
)

else:
query = query.where(
(self.BOE.posting_date[self.from_date : self.to_date])
& (IfNull(self.BOE.reconciliation_status, "") != "Reconciled")
& (IfNull(self.BOE.reconciliation_status, "").notin(match_found))
)

return query.run(as_dict=True)
Expand Down Expand Up @@ -745,6 +747,8 @@ def reconcile(self, category, amended_category):
"""
Reconcile purchases and inward supplies for given category.
"""
self.category = category

# GSTIN Level matching
purchases = self.get_unmatched_purchase_or_bill_of_entry(category)
inward_supplies = self.get_unmatched_inward_supply(category, amended_category)
Expand Down Expand Up @@ -789,12 +793,13 @@ def reconcile_for_rule(self, purchases, inward_supplies, match_status, rules):
for inward_supply_name, inward_supply in (
inward_supplies[supplier_gstin].copy().items()
):
if match_status == "Residual Match":
if (
abs((purchase.bill_date - inward_supply.bill_date).days)
> 10
):
continue
if (
match_status == "Residual Match"
and self.category != "CDNR"
and abs((purchase.bill_date - inward_supply.bill_date).days)
> 10
):
continue

if not self.is_doc_matching(purchase, inward_supply, rules):
continue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<tr class="text-center">
<th></th>
<th>2A / 2B</th>
<th>Purchase</th>
<th>{{ purchase.doctype }}</th>
</tr>
</thead>
<tbody data-label="detail-view-content">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ const ALERT_HTML = `
<div>
You have missing GSTR-2B downloads
</div>
${api_enabled
? `<a id="download-gstr2b-button" href="#" class="alert-link">
${
api_enabled
? `<a id="download-gstr2b-button" href="#" class="alert-link">
Download 2B
</a>`
: ""
}
: ""
}
</div>
`;

Expand Down Expand Up @@ -96,30 +97,31 @@ frappe.ui.form.on("Purchase Reconciliation Tool", {
frm.save();
});

const action_group = __("Actions");

// add custom buttons
api_enabled
? frm.add_custom_button(__("Download 2A/2B"), () => new ImportDialog(frm))
: frm.add_custom_button(
__("Upload 2A/2B"),
() => new ImportDialog(frm, false)
);
__("Upload 2A/2B"),
() => new ImportDialog(frm, false)
);

if (!frm.purchase_reconciliation_tool?.data?.length) return;
if (frm.get_active_tab()?.df.fieldname == "invoice_tab") {
frm.add_custom_button(
__("Unlink"),
() => unlink_documents(frm),
__("Actions")
action_group
);
frm.add_custom_button(__("dropdown-divider"), () => { }, __("Actions"));
frm.add_custom_button(__("dropdown-divider"), () => {}, action_group);
}
["Accept", "Pending", "Ignore"].forEach(
action =>
frm.add_custom_button(
__(action),
() => apply_action(frm, action),
__("Actions")
)
["Accept", "Pending", "Ignore"].forEach(action =>
frm.add_custom_button(
__(action),
() => apply_action(frm, action),
action_group
)
);
frm.$wrapper
.find("[data-label='dropdown-divider']")
Expand All @@ -131,10 +133,16 @@ frappe.ui.form.on("Purchase Reconciliation Tool", {
);

// move actions button next to filters
for (let button of $(".custom-actions .inner-group-button")) {
if (button.innerText?.trim() != "Actions") continue;
for (const group_div of $(".custom-actions .inner-group-button")) {
const btn_label = group_div.querySelector("button").innerText?.trim();
if (btn_label != action_group) continue;

$(".custom-button-group .inner-group-button").remove();
$(button).appendTo($(".custom-button-group"));

// to hide `Actions` button group on smaller screens
$(group_div).addClass("hidden-md");

$(group_div).appendTo($(".custom-button-group"));
}
},

Expand Down Expand Up @@ -191,8 +199,8 @@ frappe.ui.form.on("Purchase Reconciliation Tool", {
method == "update_api_progress"
? __("Fetching data from GSTN")
: __("Updating Inward Supply for Return Period {0}", [
data.return_period,
]);
data.return_period,
]);

frm.dashboard.show_progress(
"Import GSTR Progress",
Expand Down Expand Up @@ -377,6 +385,12 @@ class PurchaseReconciliationTool {
fieldname: "is_reverse_charge",
fieldtype: "Check",
},
{
label: "DocType",
fieldname: "purchase_doctype",
fieldtype: "Select",
options: ["Purchase Invoice", "Bill of Entry"],
},
];

fields.forEach(field => (field.parent = "Purchase Reconciliation Tool"));
Expand Down Expand Up @@ -453,47 +467,39 @@ class PurchaseReconciliationTool {
me.dm = new EmailDialog(me.frm, row);
});

this.tabs.summary_tab.$datatable.on(
"click",
".match-status",
async function (e) {
e.preventDefault();

const match_status = $(this).text();
await me.filter_group.push_new_filter([
"Purchase Reconciliation Tool",
"match_status",
"=",
match_status,
]);
me.filter_group.apply();
}
);

this.tabs.supplier_tab.$datatable.on(
"click",
".supplier-gstin",
add_supplier_gstin_filter
);

this.tabs.invoice_tab.$datatable.on(
"click",
".supplier-gstin",
add_supplier_gstin_filter
);

async function add_supplier_gstin_filter(e) {
e.preventDefault();
const filter_map = {
// TAB: { SELECTOR: FIELDNAME }
summary: { ".match-status": "match_status" },
supplier: { ".supplier-gstin": "supplier_gstin" },
invoice: {
".match-status": "match_status",
".action-performed": "action",
".supplier-gstin": "supplier_gstin",
},
};

const supplier_gstin = $(this).text().trim();
await me.filter_group.push_new_filter([
"Purchase Reconciliation Tool",
"supplier_gstin",
"=",
supplier_gstin,
]);
me.filter_group.apply();
}
Object.keys(filter_map).forEach(tab => {
Object.keys(filter_map[tab]).forEach(selector => {
this.tabs[`${tab}_tab`].$datatable.on(
"click",
selector,
async function (e) {
e.preventDefault();
const value = $(this).text().trim();
const field = filter_map[tab][selector];

await me.filter_group.push_new_filter([
"Purchase Reconciliation Tool",
field,
"=",
value,
]);

me.filter_group.apply();
}
);
});
});
}

export_data(selected_row) {
Expand Down Expand Up @@ -743,12 +749,15 @@ class PurchaseReconciliationTool {
label: "Match Status",
fieldname: "match_status",
width: 120,
_value: (...args) => {
return `<a href="#" class='match-status'>${args[0]}</a>`;
},
},
{
label: "GST Inward <br>Supply",
fieldname: "inward_supply_name",
fieldtype: "Link",
doctype: "GST Inward Supply",
options: "GST Inward Supply",
align: "center",
width: 120,
},
Expand Down Expand Up @@ -787,6 +796,9 @@ class PurchaseReconciliationTool {
{
label: "Action",
fieldname: "action",
_value: (...args) => {
return `<a href="#" class='action-performed'>${args[0]}</a>`;
},
},
];
}
Expand Down Expand Up @@ -921,8 +933,9 @@ class DetailViewDialog {
? ["GST Inward Supply"]
: ["Purchase Invoice", "Bill of Entry"],

read_only_depends_on: `eval: ${this.missing_doctype == "GST Inward Supply"
}`,
read_only_depends_on: `eval: ${
this.missing_doctype == "GST Inward Supply"
}`,

onchange: () => {
const doctype = this.dialog.get_value("doctype");
Expand Down Expand Up @@ -1243,8 +1256,7 @@ class ImportDialog {
download_gstr_by_period(only_missing) {
if (only_missing && this.has_no_pending_download) {
frappe.msgprint({
message:
"There are no pending downloads for the selected period.",
message: "There are no pending downloads for the selected period.",
title: "No Pending Downloads",
indicator: "orange",
});
Expand Down Expand Up @@ -1830,6 +1842,7 @@ async function create_new_purchase_invoice(row, company, company_gstin) {
bill_no: doc.bill_no,
bill_date: doc.bill_date,
is_reverse_charge: ["Yes", 1].includes(doc.is_reverse_charge) ? 1 : 0,
is_return: ["CDNR", "CDNRA"].includes(doc.classification) ? 1 : 0,
};

_set_value({
Expand Down
Loading
Loading