Skip to content

Commit

Permalink
refactor: company tax setup in setup wizard (#1510)
Browse files Browse the repository at this point in the history
* fix: enqueue company tax setup in setup wizard

* fix: remove duplicate check after refactor

(cherry picked from commit 7f5baa1)
  • Loading branch information
vorasmit authored and mergify[bot] committed Dec 31, 2023
1 parent fa44789 commit 5c10828
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
19 changes: 16 additions & 3 deletions india_compliance/public/js/setup_wizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,21 @@ function update_erpnext_slides_settings() {
fieldname: "default_gst_rate",
fieldtype: "Select",
label: __("Default GST Rate"),
options: [0.0, 0.1, 0.25, 1.0, 1.5, 3.0, 5.0, 6.0, 7.5, 12.0, 18.0, 28.0],
default: 18.0,
options: [
"0.0",
"0.1",
"0.25",
"1.0",
"1.5",
"3.0",
"5.0",
"6.0",
"7.5",
"12.0",
"18.0",
"28.0",
],
default: "18.0",
});

slide.fields.push({
Expand Down Expand Up @@ -56,7 +69,7 @@ async function autofill_company_info(slide) {

if (gstin_info.business_name) {
await slide.get_field("company_name").set_value(gstin_info.business_name);
slide.get_input("company_name").trigger("change");
slide.get_input("company_name").trigger("input");
}

set_gstin_description(gstin_field, gstin_info.status);
Expand Down
23 changes: 5 additions & 18 deletions india_compliance/setup_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,12 @@ def get_setup_wizard_stages(params=None):
},
{
"status": _("Wrapping up"),
"fail_msg": _("Failed to Update Company GSTIN"),
"fail_msg": _("Failed to Setup Company Taxes"),
"tasks": [
{
"fn": setup_company_gstin_details,
"fn": setup_company_taxes,
"args": params,
"fail_msg": _("Failed to Update Company GSTIN"),
}
],
},
{
"status": _("Wrapping up"),
"fail_msg": _("Failed to Create Tax Template"),
"tasks": [
{
"fn": setup_tax_template,
"args": params,
"fail_msg": _("Failed to Create Tax Template"),
"fail_msg": _("Failed to Setup Company Taxes"),
}
],
},
Expand All @@ -59,7 +48,7 @@ def configure_audit_trail(params):
enable_audit_trail()


def setup_company_gstin_details(params):
def setup_company_taxes(params):
if not params.company_gstin:
return

Expand All @@ -72,6 +61,7 @@ def setup_company_gstin_details(params):

update_company_info(params, gstin_info.gst_category)
create_address(gstin_info, params)
setup_tax_template(params)

Check warning on line 64 in india_compliance/setup_wizard.py

View check run for this annotation

Codecov / codecov/patch

india_compliance/setup_wizard.py#L64

Added line #L64 was not covered by tests


def update_company_info(params, gst_category=None):
Expand Down Expand Up @@ -111,9 +101,6 @@ def can_fetch_gstin_info():


def setup_tax_template(params):
if not (params.company_name and frappe.db.exists("Company", params.company_name)):
return

if not params.default_gst_rate:
params.default_gst_rate = "18.0"

Expand Down

0 comments on commit 5c10828

Please sign in to comment.