Skip to content

Commit

Permalink
Merge pull request #1809 from resilient-tech/version-15-hotfix
Browse files Browse the repository at this point in the history
chore: release v15
  • Loading branch information
sagarvora authored Mar 1, 2024
2 parents c1a402e + adf032a commit 762bd29
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 29 deletions.
15 changes: 15 additions & 0 deletions india_compliance/gst_india/overrides/test_advance_payment_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,21 @@ def test_advance_payment_entry(self):
],
)

def test_advance_payment_entry_with_returns(self):
payment_doc = self._create_payment_entry()
invoice_doc = self._create_sales_invoice(payment_doc)

create_transaction(
doctype="Sales Invoice",
is_in_state=1,
is_return=1,
qty=-1,
reason_for_issuing_document="01-Sales Return",
return_against=invoice_doc.name,
)

self.assertGLEntries(payment_doc, self.EXPECTED_GL)

def test_first_sales_then_payment_entry(self):
invoice_doc, payment_doc = self._create_invoice_then_payment()
payment_doc.submit()
Expand Down
1 change: 0 additions & 1 deletion india_compliance/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@
"validate": "india_compliance.gst_india.overrides.tax_category.validate"
},
"Tax Withholding Category": {
"validate": "india_compliance.income_tax_india.overrides.tax_withholding_category.validate",
"on_change": "india_compliance.income_tax_india.overrides.tax_withholding_category.on_change",
},
"Unreconcile Payment": {
Expand Down
13 changes: 7 additions & 6 deletions india_compliance/income_tax_india/overrides/company.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,23 @@ def create_or_update_tax_withholding_category(company):
categories = get_tds_category_details(accounts)

for category_doc in categories:
existing_category_name = frappe.get_value(
existing_category_list = frappe.get_all(
"Tax Withholding Category",
{
"tds_section": category_doc.get("tds_section"),
"entity_type": category_doc.get("entity_type"),
},
pluck="name",
)

if not existing_category_name:
if not existing_category_list:
doc = frappe.get_doc(category_doc)
doc.insert(ignore_if_duplicate=True, ignore_mandatory=ignore_mandatory)

else:
update_existing_tax_withholding_category(
category_doc, existing_category_name, company
)
for category_name in existing_category_list:
update_existing_tax_withholding_category(
category_doc, category_name, company
)


def update_existing_tax_withholding_category(category_doc, category_name, company):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import frappe
from frappe.utils import get_link_to_form


def on_change(doc, method=None):
Expand All @@ -17,24 +16,3 @@ def _get_tax_withholding_accounts():
return frappe.cache.hget(
"tax_withholding_accounts", company, generator=_get_tax_withholding_accounts
)


def validate(doc, method=None):
if not (doc.tds_section or doc.entity_type):
return

existing_doc = frappe.db.exists(
"Tax Withholding Category",
{
"tds_section": doc.tds_section,
"entity_type": doc.entity_type,
"name": ("!=", doc.name),
},
)

if not existing_doc:
return

frappe.throw(
f'{get_link_to_form("Tax Withholding Category",existing_doc)} already exists for the TDS section - {doc.tds_section} and Entity type - {doc.entity_type}.'
)

0 comments on commit 762bd29

Please sign in to comment.