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

refactor: company tax setup in setup wizard #1510

Merged
merged 2 commits into from Dec 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 16 additions & 3 deletions india_compliance/public/js/setup_wizard.js
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
vorasmit marked this conversation as resolved.
Show resolved Hide resolved
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)


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