Skip to content

Commit

Permalink
Merge pull request resilient-tech#1240 from vorasmit/multi-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vorasmit authored Nov 4, 2023
2 parents 1205f20 + 1388a92 commit 472038f
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
)
);
}
Expand Down
11 changes: 9 additions & 2 deletions india_compliance/gst_india/overrides/company.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
)
14 changes: 7 additions & 7 deletions india_compliance/gst_india/overrides/ineligible_itc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <strong>Default GST Expense Account</strong> 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"

Expand Down Expand Up @@ -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 <strong>Default GST Expense Account</strong> 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
Expand Down
1 change: 0 additions & 1 deletion india_compliance/gst_india/setup/property_setters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
]
Expand Down
2 changes: 1 addition & 1 deletion india_compliance/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
15 changes: 2 additions & 13 deletions india_compliance/patches/post_install/update_company_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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):
Expand Down

0 comments on commit 472038f

Please sign in to comment.