Skip to content

Commit

Permalink
Merge pull request #1143 from resilient-tech/mergify/bp/version-14-ho…
Browse files Browse the repository at this point in the history
…tfix/pr-1142

fix issues reported by codacy (backport #1142)
  • Loading branch information
vorasmit authored Oct 12, 2023
2 parents 4fc1d18 + 10fef70 commit 6d190fe
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
)
Expand All @@ -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",
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
) {
Expand Down Expand Up @@ -1025,15 +1025,15 @@ 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,
label: "Taxable Amount Difference",
datatype: "Currency",
currency: frappe.boot.sysdefaults.currency,
indicator:
this.row.taxable_value_difference == 0
this.row.taxable_value_difference === 0
? "text-success"
: "text-danger",
},
Expand Down Expand Up @@ -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;
Expand Down
24 changes: 12 additions & 12 deletions india_compliance/gst_india/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down
16 changes: 8 additions & 8 deletions india_compliance/gst_india/utils/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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("")

Expand Down Expand Up @@ -235,15 +235,15 @@ 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,
end_column=column,
)

self.ws.conditional_formatting.add(
range,
cell_range,
FormulaRule(
formula=[formula],
stopIfTrue=True,
Expand Down
4 changes: 2 additions & 2 deletions india_compliance/gst_india/utils/gstr/gstr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion india_compliance/gst_india/utils/gstr/gstr_2a.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6d190fe

Please sign in to comment.