diff --git a/india_compliance/gst_india/doctype/purchase_reconciliation_tool/__init__.py b/india_compliance/gst_india/doctype/purchase_reconciliation_tool/__init__.py index 570c47d43..f1f06752a 100644 --- a/india_compliance/gst_india/doctype/purchase_reconciliation_tool/__init__.py +++ b/india_compliance/gst_india/doctype/purchase_reconciliation_tool/__init__.py @@ -959,7 +959,7 @@ def get_manually_matched_data(self, purchase_name: str, inward_supply_name: str) This can be used to show comparision of matched values. """ inward_supplies = self.get_all_inward_supply( - [inward_supply_name], only_names=True + names=[inward_supply_name], only_names=True ) purchases = self.get_all_purchase_invoice_and_bill_of_entry( "", [purchase_name], only_names=True @@ -993,7 +993,7 @@ def get(self, purchase_names: list = None, inward_supply_names: list = None): if inward_supply_names or purchase_names: retain_doc = only_names = True - inward_supplies = self.get_all_inward_supply(inward_supply_names) + inward_supplies = self.get_all_inward_supply(names=inward_supply_names) purchases_and_bill_of_entry = self.get_all_purchase_invoice_and_bill_of_entry( inward_supplies, purchase_names, only_names ) @@ -1017,7 +1017,9 @@ def get(self, purchase_names: list = None, inward_supply_names: list = None): self.process_data(reconciliation_data, retain_doc=retain_doc) return reconciliation_data - def get_all_inward_supply(self, inward_supply_names=None, only_names=False): + def get_all_inward_supply( + self, additional_fields=None, names=None, only_names=False + ): inward_supply_fields = [ "supplier_name", "classification", @@ -1027,9 +1029,7 @@ def get_all_inward_supply(self, inward_supply_names=None, only_names=False): "link_name", ] - return super().get_all_inward_supply( - inward_supply_fields, inward_supply_names, only_names - ) + return super().get_all_inward_supply(inward_supply_fields, names, only_names) def get_all_purchase_invoice_and_bill_of_entry( self, inward_supplies, purchase_names, only_names=False diff --git a/india_compliance/gst_india/doctype/purchase_reconciliation_tool/purchase_reconciliation_tool.css b/india_compliance/gst_india/doctype/purchase_reconciliation_tool/purchase_reconciliation_tool.css index c2345fbd8..609a3af1c 100644 --- a/india_compliance/gst_india/doctype/purchase_reconciliation_tool/purchase_reconciliation_tool.css +++ b/india_compliance/gst_india/doctype/purchase_reconciliation_tool/purchase_reconciliation_tool.css @@ -14,7 +14,7 @@ div[data-page-route="Purchase Reconciliation Tool"] display: flex; justify-content: space-between; align-items: center; - border-bottom: 0px solid black; + border-bottom: 0 solid black; padding-right: var(--padding-lg); position: inherit; } diff --git a/india_compliance/gst_india/doctype/purchase_reconciliation_tool/purchase_reconciliation_tool.js b/india_compliance/gst_india/doctype/purchase_reconciliation_tool/purchase_reconciliation_tool.js index ad6be32a0..6829c15a3 100644 --- a/india_compliance/gst_india/doctype/purchase_reconciliation_tool/purchase_reconciliation_tool.js +++ b/india_compliance/gst_india/doctype/purchase_reconciliation_tool/purchase_reconciliation_tool.js @@ -130,7 +130,7 @@ frappe.ui.form.on("Purchase Reconciliation Tool", { frm.flag_last_return_period = data.return_period; } if ( - current_progress == 100 && + current_progress === 100 && method != "update_api_progress" && frm.flag_last_return_period == data.return_period ) { @@ -1025,7 +1025,7 @@ class DetailViewDialog { datatype: "Currency", currency: frappe.boot.sysdefaults.currency, indicator: - this.row.tax_difference == 0 ? "text-success" : "text-danger", + this.row.tax_difference === 0 ? "text-success" : "text-danger", }, { value: this.row.taxable_value_difference, @@ -1033,7 +1033,7 @@ class DetailViewDialog { datatype: "Currency", currency: frappe.boot.sysdefaults.currency, indicator: - this.row.taxable_value_difference == 0 + this.row.taxable_value_difference === 0 ? "text-success" : "text-danger", }, @@ -1645,7 +1645,7 @@ async function set_gstin_options(frm) { args: params, }); - if (!message) return; + if (!message) return []; const gstin_field = frm.get_field("company_gstin"); gstin_field.set_data(message); return message; diff --git a/india_compliance/gst_india/utils/__init__.py b/india_compliance/gst_india/utils/__init__.py index d61389460..c54a4022e 100644 --- a/india_compliance/gst_india/utils/__init__.py +++ b/india_compliance/gst_india/utils/__init__.py @@ -206,7 +206,9 @@ def validate_gst_category(gst_category, gstin): if gst_category == "Unregistered": frappe.throw( - "GST Category cannot be Unregistered for party with GSTIN", + _( + "GST Category cannot be Unregistered for party with GSTIN", + ) ) valid_gstin_format = GSTIN_FORMATS.get(gst_category) @@ -631,19 +633,17 @@ def get_timespan_date_range(timespan: str, company: str | None = None) -> tuple company = company or frappe.defaults.get_user_default("Company") - match timespan: - case "this fiscal year": - date = getdate() - fiscal_year = get_fiscal_year(date, company=company) - return (fiscal_year[1], fiscal_year[2]) + if timespan == "this fiscal year": + date = getdate() + fiscal_year = get_fiscal_year(date, company=company) + return (fiscal_year[1], fiscal_year[2]) - case "last fiscal year": - date = add_to_date(getdate(), years=-1) - fiscal_year = get_fiscal_year(date, company=company) - return (fiscal_year[1], fiscal_year[2]) + if timespan == "last fiscal year": + date = add_to_date(getdate(), years=-1) + fiscal_year = get_fiscal_year(date, company=company) + return (fiscal_year[1], fiscal_year[2]) - case _: - return + return def merge_dicts(d1: dict, d2: dict) -> dict: diff --git a/india_compliance/gst_india/utils/exporter.py b/india_compliance/gst_india/utils/exporter.py index 37a1f76b9..f3695abb4 100644 --- a/india_compliance/gst_india/utils/exporter.py +++ b/india_compliance/gst_india/utils/exporter.py @@ -144,7 +144,7 @@ def add_merged_header(self, merged_headers): merge_from_idx = self.get_column_index(value[0]) merge_to_idx = self.get_column_index(value[1]) - range = self.get_range( + cell_range = self.get_range( start_row=self.row_dimension, start_column=merge_from_idx, end_row=self.row_dimension, @@ -153,7 +153,7 @@ def add_merged_header(self, merged_headers): self.ws.cell(row=self.row_dimension, column=merge_from_idx).value = key - self.ws.merge_cells(range) + self.ws.merge_cells(cell_range) self.apply_format( row=self.row_dimension, @@ -167,12 +167,12 @@ def get_totals(self): """build total row array of fields to be calculated""" total_row = [] - for idx, property in enumerate(self.headers, 1): + for idx, column in enumerate(self.headers, 1): if idx == 1: total_row.append("Totals") - elif property.get("fieldtype") in ("Float", "Int"): - range = self.get_range(self.data_row, idx, self.ws.max_row, idx) - total_row.append(f"=SUM({range})") + elif column.get("fieldtype") in ("Float", "Int"): + cell_range = self.get_range(self.data_row, idx, self.ws.max_row, idx) + total_row.append(f"=SUM({cell_range})") else: total_row.append("") @@ -235,7 +235,7 @@ def apply_conditional_formatting(self, has_totals): # eg formula used: IF(ISBLANK(H6), FALSE, H6<>R6) formula = f"IF(ISBLANK({column}{self.data_row}), FALSE, {column}{self.data_row}<>{compare_column}{self.data_row})" - range = self.get_range( + cell_range = self.get_range( start_row=self.data_row, start_column=column, end_row=self.ws.max_row - has_totals, @@ -243,7 +243,7 @@ def apply_conditional_formatting(self, has_totals): ) self.ws.conditional_formatting.add( - range, + cell_range, FormulaRule( formula=[formula], stopIfTrue=True, diff --git a/india_compliance/gst_india/utils/gstr/gstr.py b/india_compliance/gst_india/utils/gstr/gstr.py index e56a8b63f..afa480ac4 100644 --- a/india_compliance/gst_india/utils/gstr/gstr.py +++ b/india_compliance/gst_india/utils/gstr/gstr.py @@ -6,8 +6,8 @@ ) -def get_mapped_value(value, map): - return map.get(value) +def get_mapped_value(value, mapping): + return mapping.get(value) class GSTR: diff --git a/india_compliance/gst_india/utils/gstr/gstr_2a.py b/india_compliance/gst_india/utils/gstr/gstr_2a.py index 8d581a689..ca9767d45 100644 --- a/india_compliance/gst_india/utils/gstr/gstr_2a.py +++ b/india_compliance/gst_india/utils/gstr/gstr_2a.py @@ -194,7 +194,7 @@ def get_invoice_details(self, invoice): "document_value": invoice.iamt + invoice.camt + invoice.samt + invoice.cess, } - def get_transaction_item(self, item): + def get_transaction_item(self, item, item_number=None): transaction_item = super().get_transaction_item(item) transaction_item["cess"] = item.cess return transaction_item