From 05d1a5beca2f90f7b266c115699e47d27391a9a1 Mon Sep 17 00:00:00 2001 From: Smit Vora Date: Fri, 23 Aug 2024 11:41:50 +0530 Subject: [PATCH 1/5] test: check if post install patches exist (cherry picked from commit acb765168423fcf560cff5479551b72b60996630) --- india_compliance/test_patches.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 india_compliance/test_patches.py diff --git a/india_compliance/test_patches.py b/india_compliance/test_patches.py new file mode 100644 index 000000000..f0170b8c1 --- /dev/null +++ b/india_compliance/test_patches.py @@ -0,0 +1,14 @@ +import frappe +from frappe.tests.utils import FrappeTestCase + +from india_compliance.install import POST_INSTALL_PATCHES + + +class TestPatches(FrappeTestCase): + def test_post_install_patch_exists(self): + for patch in POST_INSTALL_PATCHES: + self.assertTrue( + frappe.get_attr( + f"india_compliance.patches.post_install.{patch}.execute" + ) + ) From 379e451c0dd8901390b000c46d455924656580f9 Mon Sep 17 00:00:00 2001 From: Sanket322 Date: Fri, 23 Aug 2024 14:46:03 +0530 Subject: [PATCH 2/5] fix: test patches of patch.txt exists (cherry picked from commit 7ac6c00215075b601695e8d42d7876d86287418d) --- india_compliance/test_patches.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/india_compliance/test_patches.py b/india_compliance/test_patches.py index f0170b8c1..5d4143853 100644 --- a/india_compliance/test_patches.py +++ b/india_compliance/test_patches.py @@ -1,4 +1,5 @@ import frappe +from frappe.modules.patch_handler import get_patches_from_app from frappe.tests.utils import FrappeTestCase from india_compliance.install import POST_INSTALL_PATCHES @@ -12,3 +13,22 @@ def test_post_install_patch_exists(self): f"india_compliance.patches.post_install.{patch}.execute" ) ) + + def test_patches_exists(self): + patches = get_patches_from_app("india_compliance") + + for patch in patches: + if patch.startswith("execute:"): + import_path = patch.split("execute:")[1] + + if not import_path.startswith("from"): + continue + + components = import_path.split("from")[1].split() + module = components[0] + function_name = components[2].replace(";", "").replace(",", "") + patch_path = module + "." + function_name + else: + patch_path = f"{patch.split(maxsplit=1)[0]}.execute" + + frappe.get_attr(patch_path) From 74c21a0119ddbe4c0d32a5f78c6db478f4144b0e Mon Sep 17 00:00:00 2001 From: Smit Vora Date: Sat, 24 Aug 2024 10:40:19 +0530 Subject: [PATCH 3/5] fix: Remove unused "reason_for_issuing_document" field (cherry picked from commit 09e96236d4465299f796bd479e9df1f0d6fdc8e2) # Conflicts: # india_compliance/patches.txt --- .../gst_india/constants/custom_fields.py | 15 --------------- .../overrides/test_advance_payment_entry.py | 1 - .../gst_india/report/gstr_1/gstr_1.py | 1 - india_compliance/patches.txt | 7 +++++++ .../patches/post_install/remove_old_fields.py | 1 + 5 files changed, 8 insertions(+), 17 deletions(-) diff --git a/india_compliance/gst_india/constants/custom_fields.py b/india_compliance/gst_india/constants/custom_fields.py index 31e897524..0ca29afe4 100644 --- a/india_compliance/gst_india/constants/custom_fields.py +++ b/india_compliance/gst_india/constants/custom_fields.py @@ -543,21 +543,6 @@ ), "translatable": 0, }, - { - "fieldname": "reason_for_issuing_document", - "label": "Reason For Issuing Document", - "fieldtype": "Select", - "insert_after": "return_against", - "print_hide": 1, - "depends_on": "eval:doc.is_return == 1", - "length": 45, - "options": ( - "\n01-Sales Return\n02-Post Sale Discount\n03-Deficiency in" - " services\n04-Correction in Invoice\n05-Change in POS\n06-Finalization" - " of Provisional assessment\n07-Others" - ), - "translatable": 0, - }, ], ( "Sales Taxes and Charges", diff --git a/india_compliance/gst_india/overrides/test_advance_payment_entry.py b/india_compliance/gst_india/overrides/test_advance_payment_entry.py index 96ff33c92..c9d6e73f5 100644 --- a/india_compliance/gst_india/overrides/test_advance_payment_entry.py +++ b/india_compliance/gst_india/overrides/test_advance_payment_entry.py @@ -79,7 +79,6 @@ def test_advance_payment_entry_with_returns(self): is_in_state=1, is_return=1, qty=-1, - reason_for_issuing_document="01-Sales Return", return_against=invoice_doc.name, ) diff --git a/india_compliance/gst_india/report/gstr_1/gstr_1.py b/india_compliance/gst_india/report/gstr_1/gstr_1.py index 879025f9e..9110b50bc 100644 --- a/india_compliance/gst_india/report/gstr_1/gstr_1.py +++ b/india_compliance/gst_india/report/gstr_1/gstr_1.py @@ -78,7 +78,6 @@ def __init__(self, filters=None): port_code, shipping_bill_number, shipping_bill_date, - reason_for_issuing_document, company_gstin, ( CASE diff --git a/india_compliance/patches.txt b/india_compliance/patches.txt index 2063a052f..f35bfc76b 100644 --- a/india_compliance/patches.txt +++ b/india_compliance/patches.txt @@ -3,10 +3,17 @@ execute:import frappe; frappe.delete_doc_if_exists("DocType", "GSTIN") [post_model_sync] india_compliance.patches.v14.set_default_for_overridden_accounts_setting +<<<<<<< HEAD execute:from india_compliance.gst_india.setup import create_custom_fields; create_custom_fields() #51 execute:from india_compliance.gst_india.setup import create_property_setters; create_property_setters() #7 execute:from india_compliance.income_tax_india.setup import create_custom_fields; create_custom_fields() #1 india_compliance.patches.post_install.remove_old_fields #1 +======= +execute:from india_compliance.gst_india.setup import create_custom_fields; create_custom_fields() #54 +execute:from india_compliance.gst_india.setup import create_property_setters; create_property_setters() #8 +execute:from india_compliance.income_tax_india.setup import create_custom_fields; create_custom_fields() #2 +india_compliance.patches.post_install.remove_old_fields #2 +>>>>>>> 09e96236 (fix: Remove unused "reason_for_issuing_document" field) india_compliance.patches.post_install.set_gst_tax_type india_compliance.patches.post_install.set_gst_tax_type_in_journal_entry india_compliance.patches.post_install.update_company_gstin diff --git a/india_compliance/patches/post_install/remove_old_fields.py b/india_compliance/patches/post_install/remove_old_fields.py index 1a4a007ac..f92830d9a 100644 --- a/india_compliance/patches/post_install/remove_old_fields.py +++ b/india_compliance/patches/post_install/remove_old_fields.py @@ -19,6 +19,7 @@ def execute(): delete_old_fields("pan_details", "Company") delete_old_fields("export_type", ("Customer", "Supplier")) delete_old_fields("company_address", "Journal Entry") + delete_old_fields("reason_for_issuing_document", "Sales Invoice") # Field renamed post release delete_old_fields( From 83346f4132f96cb0543296529842e6b5679f1715 Mon Sep 17 00:00:00 2001 From: Smit Vora Date: Sat, 24 Aug 2024 12:18:43 +0530 Subject: [PATCH 4/5] chore: resolve conflicts with patches --- india_compliance/patches.txt | 7 ------- 1 file changed, 7 deletions(-) diff --git a/india_compliance/patches.txt b/india_compliance/patches.txt index f35bfc76b..8ab27040f 100644 --- a/india_compliance/patches.txt +++ b/india_compliance/patches.txt @@ -3,17 +3,10 @@ execute:import frappe; frappe.delete_doc_if_exists("DocType", "GSTIN") [post_model_sync] india_compliance.patches.v14.set_default_for_overridden_accounts_setting -<<<<<<< HEAD execute:from india_compliance.gst_india.setup import create_custom_fields; create_custom_fields() #51 execute:from india_compliance.gst_india.setup import create_property_setters; create_property_setters() #7 execute:from india_compliance.income_tax_india.setup import create_custom_fields; create_custom_fields() #1 -india_compliance.patches.post_install.remove_old_fields #1 -======= -execute:from india_compliance.gst_india.setup import create_custom_fields; create_custom_fields() #54 -execute:from india_compliance.gst_india.setup import create_property_setters; create_property_setters() #8 -execute:from india_compliance.income_tax_india.setup import create_custom_fields; create_custom_fields() #2 india_compliance.patches.post_install.remove_old_fields #2 ->>>>>>> 09e96236 (fix: Remove unused "reason_for_issuing_document" field) india_compliance.patches.post_install.set_gst_tax_type india_compliance.patches.post_install.set_gst_tax_type_in_journal_entry india_compliance.patches.post_install.update_company_gstin From ca9506e21db94c30e5b90dc024649d6348b10323 Mon Sep 17 00:00:00 2001 From: Khushi Rawat <142375893+khushi8112@users.noreply.github.com> Date: Sat, 24 Aug 2024 00:35:46 +0530 Subject: [PATCH 5/5] fix: adjust depreciation when daily prorata is enabled (cherry picked from commit 1e6f6893248666f4e8c2b0742da50c70aec011da) --- india_compliance/income_tax_india/overrides/asset.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/india_compliance/income_tax_india/overrides/asset.py b/india_compliance/income_tax_india/overrides/asset.py index 982f02b7f..7502d31da 100644 --- a/india_compliance/income_tax_india/overrides/asset.py +++ b/india_compliance/income_tax_india/overrides/asset.py @@ -82,7 +82,7 @@ def get_wdv_or_dd_depr_amount( flt(fb_row.rate_of_depreciation) / 100 ) # if leap year, then consider 366 days - if cint(schedule_date.year) % 4 == 0: + if cint(schedule_date.year) % 4 == 0 and fb_row.daily_prorata_based: depreciation_amount = depreciation_amount * 366 / 365 elif fb_row.frequency_of_depreciation == 1: if fb_row.daily_prorata_based: