diff --git a/india_compliance/gst_india/client_scripts/e_waybill_actions.js b/india_compliance/gst_india/client_scripts/e_waybill_actions.js index 8a945ee77a..d534cd98f1 100644 --- a/india_compliance/gst_india/client_scripts/e_waybill_actions.js +++ b/india_compliance/gst_india/client_scripts/e_waybill_actions.js @@ -319,7 +319,7 @@ function get_generate_e_waybill_dialog(opts, frm) { }, }; }, - onchange: () => update_gst_tranporter_id(d, frm.doc), + onchange: () => update_gst_tranporter_id(d), }, { label: "Distance (in km)", @@ -558,7 +558,7 @@ function show_cancel_e_waybill_dialog(frm, callback) { } function show_mark_e_waybill_as_cancelled_dialog(frm) { - fields = get_cancel_e_waybill_dialog_fields(frm); + const fields = get_cancel_e_waybill_dialog_fields(frm); fields.push({ label: "Cancelled On", fieldname: "cancelled_on", 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 39659c8eef..e2e4cd1647 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 @@ -1169,7 +1169,7 @@ class ImportDialog { frappe.throw( __( "Please make sure you have uploaded the correct file. File Uploaded is not for {0}", - [return_type] + [this.return_type] ) ); } diff --git a/india_compliance/gst_india/overrides/company.py b/india_compliance/gst_india/overrides/company.py index 8e254ed778..63a267d584 100644 --- a/india_compliance/gst_india/overrides/company.py +++ b/india_compliance/gst_india/overrides/company.py @@ -161,8 +161,13 @@ def create_default_company_account( parent, default_fieldname=None, ): + """ + Creats a default company account if missing + Updates the company with the default account name + """ parent_account = frappe.db.get_value( - "Account", filters={"account_name": parent, "company": company} + "Account", + filters={"account_name": parent, "company": company, "is_group": 1}, ) if not parent_account: @@ -181,7 +186,9 @@ def create_default_company_account( account.flags.ignore_permissions = True account.insert(ignore_if_duplicate=True) - if default_fieldname: + if default_fieldname and not frappe.db.get_value( + "Company", company, default_fieldname + ): frappe.db.set_value( "Company", company, default_fieldname, account.name, update_modified=False ) diff --git a/india_compliance/gst_india/overrides/ineligible_itc.py b/india_compliance/gst_india/overrides/ineligible_itc.py index 8978c57d5e..5dee3e1b7c 100644 --- a/india_compliance/gst_india/overrides/ineligible_itc.py +++ b/india_compliance/gst_india/overrides/ineligible_itc.py @@ -20,13 +20,6 @@ def __init__(self, doc): self.is_perpetual = self.company.enable_perpetual_inventory self.cost_center = doc.cost_center or self.company.cost_center - if not self.company.default_gst_expense_account: - frappe.throw( - _( - "Please set Default GST Expense Account in Company {0}" - ).format(get_link_to_form("Company", self.company.name)) - ) - self.dr_or_cr = "credit" if doc.get("is_return") else "debit" self.cr_or_dr = "debit" if doc.get("is_return") else "credit" @@ -69,6 +62,13 @@ def update_gl_entries(self, gl_entries): if not self.doc.get("_has_ineligible_itc_items"): return gl_entries + if not self.company.default_gst_expense_account: + frappe.throw( + _( + "Please set Default GST Expense Account in Company {0}" + ).format(get_link_to_form("Company", self.company.name)) + ) + for item in self.doc.items: if not item.get("_ineligible_tax_amount"): continue diff --git a/india_compliance/gst_india/setup/property_setters.py b/india_compliance/gst_india/setup/property_setters.py index d7c67ed6ed..e3390253d9 100644 --- a/india_compliance/gst_india/setup/property_setters.py +++ b/india_compliance/gst_india/setup/property_setters.py @@ -98,7 +98,6 @@ def get_property_setters(): "doctype": "Purchase Reconciliation Tool", "doctype_or_field": "DocType", "property": "default_email_template", - "propery_type": "Link", "value": "Purchase Reconciliation", }, ] diff --git a/india_compliance/patches.txt b/india_compliance/patches.txt index 66a67c0adc..fd9f8ade32 100644 --- a/india_compliance/patches.txt +++ b/india_compliance/patches.txt @@ -31,6 +31,6 @@ execute:from india_compliance.gst_india.setup import create_email_template; crea india_compliance.patches.post_install.update_reconciliation_status india_compliance.patches.post_install.update_payment_entry_fields india_compliance.patches.v15.remove_ignore_reconciliation_field -india_compliance.patches.post_install.update_company_fixtures +india_compliance.patches.post_install.update_company_fixtures #1 india_compliance.patches.post_install.update_itc_classification_field india_compliance.patches.v14.update_purchase_reco_email_template diff --git a/india_compliance/patches/post_install/update_company_fixtures.py b/india_compliance/patches/post_install/update_company_fixtures.py index e2b25a3fde..7e7dd27536 100644 --- a/india_compliance/patches/post_install/update_company_fixtures.py +++ b/india_compliance/patches/post_install/update_company_fixtures.py @@ -12,10 +12,6 @@ def execute(): - """ - This patch is used to create company fixtures for Indian Companies created before installing India Compliance. - """ - company_list = frappe.get_all( "Company", filters={"country": "India"}, pluck="name", order_by="lft asc" ) @@ -31,15 +27,8 @@ def execute(): if not frappe.db.exists("GST Account", {"company": company}): make_default_tax_templates(company) - if not frappe.db.exists( - "Account", {"company": company, "account_name": "Customs Duty Payable"} - ): - make_default_customs_accounts(company) - - if not frappe.db.exists( - "Account", {"company": company, "account_name": "GST Expense"} - ): - make_default_gst_expense_accounts(company) + make_default_customs_accounts(company) + make_default_gst_expense_accounts(company) def update_root_for_rcm(company):