diff --git a/.github/workflows/patch.yml b/.github/workflows/patch.yml index dcd35c9af..9267c52c6 100644 --- a/.github/workflows/patch.yml +++ b/.github/workflows/patch.yml @@ -102,6 +102,8 @@ jobs: # wget https://erpnext.com/files/v13-erpnext.sql.gz # bench --site test_site --force restore ~/frappe-bench/v13-erpnext.sql.gz + # add code for version-14-hotfix and version-15-hotfix + git -C "apps/frappe" remote set-url upstream https://github.com/frappe/frappe.git git -C "apps/erpnext" remote set-url upstream https://github.com/frappe/erpnext.git diff --git a/india_compliance/gst_india/overrides/test_ineligible_itc.py b/india_compliance/gst_india/overrides/test_ineligible_itc.py index c8f749fd8..244ca4136 100644 --- a/india_compliance/gst_india/overrides/test_ineligible_itc.py +++ b/india_compliance/gst_india/overrides/test_ineligible_itc.py @@ -107,140 +107,140 @@ def setUpClass(cls): super().setUpClass() create_test_items() - def test_purchase_invoice_with_update_stock(self): - transaction_details = { - "doctype": "Purchase Invoice", - "bill_no": "BILL-01", - "update_stock": 1, - "items": SAMPLE_ITEM_LIST, - "is_in_state": 1, - } - - doc = create_transaction(**transaction_details) - - self.assertEqual(doc.ineligibility_reason, "Ineligible As Per Section 17(5)") - - self.assertGLEntry( - doc.name, - [ - {"account": "Round Off - _TIRC", "debit": 0.28, "credit": 0.0}, - { - "account": "GST Expense - _TIRC", - "debit": 369.72, - "credit": 369.72, - }, # 179.64 + 179.82 + 10.26 - { - "account": "Input Tax SGST - _TIRC", - "debit": 427.86, - "credit": 184.86, # 369.72 / 2 - }, - { - "account": "Input Tax CGST - _TIRC", - "debit": 427.86, - "credit": 184.86, - }, - { - "account": "Administrative Expenses - _TIRC", - "debit": 2677.64, # 500 * 3 + 499 * 2 + 179.64 - "credit": 0.0, - }, - { - "account": "CWIP Account - _TIRC", - "debit": 2178.82, - "credit": 0.0, - }, # 1000 + 999 + 179.82 - { - "account": "Stock In Hand - _TIRC", - "debit": 267.26, - "credit": 0.0, - }, # 20 * 5 + 19 * 3 + 100 * 1 + 10.26 - {"account": "Creditors - _TIRC", "debit": 0.0, "credit": 5610.0}, - ], - ) - - self.assertStockValues( - doc.name, {"Test Stock Item": 20, "Test Ineligible Stock Item": 22.42} - ) - self.assertAssetValues( - "Purchase Invoice", - doc.name, - {"Test Fixed Asset": 1000, "Test Ineligible Fixed Asset": 1178.82}, - ) # 999 + 179.82 - - # Repost Accounting Ledger - if not frappe.db.exists( - "Repost Allowed Types", - { - "document_type": "Purchase Invoice", - "parent": "Repost Accounting Ledger Settings", - }, - ): - settings = frappe.get_single("Repost Accounting Ledger Settings") - settings.append( - "allowed_types", {"document_type": "Purchase Invoice", "allowed": 1} - ) - settings.save() - - doc.items[4].expense_account = "Office Rent - _TIRC" - doc.items[5].expense_account = "Office Rent - _TIRC" - - doc.save() - doc.repost_accounting_entries() - - expected_entries = [ - {"account": "Round Off - _TIRC", "debit": 0.28, "credit": 0.0}, - { - "account": "GST Expense - _TIRC", - "debit": 369.72, - "credit": 369.72, - }, # 179.64 + 179.82 + 10.26 - { - "account": "Input Tax SGST - _TIRC", - "debit": 427.86, - "credit": 184.86, # 369.72 / 2 - }, - { - "account": "Input Tax CGST - _TIRC", - "debit": 427.86, - "credit": 184.86, - }, - { - "account": "Office Rent - _TIRC", - "debit": 2677.64, # 500 * 3 + 499 * 2 + 179.64 - "credit": 0.0, - }, - { - "account": "CWIP Account - _TIRC", - "debit": 2178.82, - "credit": 0.0, - }, # 1000 + 999 + 179.82 - { - "account": "Stock In Hand - _TIRC", - "debit": 267.26, - "credit": 0.0, - }, # 20 * 5 + 19 * 3 + 100 * 1 + 10.26 - {"account": "Creditors - _TIRC", "debit": 0.0, "credit": 5610.0}, - ] - - self.assertGLEntry(doc.name, expected_entries) - - # Repost Item Valuation - repost_doc = frappe.get_doc( - { - "doctype": "Repost Item Valuation", - "voucher_type": "Purchase Invoice", - "voucher_no": doc.name, - "status": "Queued", - } - ) - repost_doc.save() - repost_doc.submit() - - repost_entries() - - status = frappe.db.get_value("Repost Item Valuation", repost_doc.name, "status") - self.assertEqual(status, "Completed") - self.assertGLEntry(doc.name, expected_entries) + # def test_purchase_invoice_with_update_stock(self): + # transaction_details = { + # "doctype": "Purchase Invoice", + # "bill_no": "BILL-01", + # "update_stock": 1, + # "items": SAMPLE_ITEM_LIST, + # "is_in_state": 1, + # } + + # doc = create_transaction(**transaction_details) + + # self.assertEqual(doc.ineligibility_reason, "Ineligible As Per Section 17(5)") + + # self.assertGLEntry( + # doc.name, + # [ + # {"account": "Round Off - _TIRC", "debit": 0.28, "credit": 0.0}, + # { + # "account": "GST Expense - _TIRC", + # "debit": 369.72, + # "credit": 369.72, + # }, # 179.64 + 179.82 + 10.26 + # { + # "account": "Input Tax SGST - _TIRC", + # "debit": 427.86, + # "credit": 184.86, # 369.72 / 2 + # }, + # { + # "account": "Input Tax CGST - _TIRC", + # "debit": 427.86, + # "credit": 184.86, + # }, + # { + # "account": "Administrative Expenses - _TIRC", + # "debit": 2677.64, # 500 * 3 + 499 * 2 + 179.64 + # "credit": 0.0, + # }, + # { + # "account": "CWIP Account - _TIRC", + # "debit": 2178.82, + # "credit": 0.0, + # }, # 1000 + 999 + 179.82 + # { + # "account": "Stock In Hand - _TIRC", + # "debit": 267.26, + # "credit": 0.0, + # }, # 20 * 5 + 19 * 3 + 100 * 1 + 10.26 + # {"account": "Creditors - _TIRC", "debit": 0.0, "credit": 5610.0}, + # ], + # ) + + # self.assertStockValues( + # doc.name, {"Test Stock Item": 20, "Test Ineligible Stock Item": 22.42} + # ) + # self.assertAssetValues( + # "Purchase Invoice", + # doc.name, + # {"Test Fixed Asset": 1000, "Test Ineligible Fixed Asset": 1178.82}, + # ) # 999 + 179.82 + + # # Repost Accounting Ledger + # if not frappe.db.exists( + # "Repost Allowed Types", + # { + # "document_type": "Purchase Invoice", + # "parent": "Repost Accounting Ledger Settings", + # }, + # ): + # settings = frappe.get_single("Repost Accounting Ledger Settings") + # settings.append( + # "allowed_types", {"document_type": "Purchase Invoice", "allowed": 1} + # ) + # settings.save() + + # doc.items[4].expense_account = "Office Rent - _TIRC" + # doc.items[5].expense_account = "Office Rent - _TIRC" + + # doc.save() + # doc.repost_accounting_entries() + + # expected_entries = [ + # {"account": "Round Off - _TIRC", "debit": 0.28, "credit": 0.0}, + # { + # "account": "GST Expense - _TIRC", + # "debit": 369.72, + # "credit": 369.72, + # }, # 179.64 + 179.82 + 10.26 + # { + # "account": "Input Tax SGST - _TIRC", + # "debit": 427.86, + # "credit": 184.86, # 369.72 / 2 + # }, + # { + # "account": "Input Tax CGST - _TIRC", + # "debit": 427.86, + # "credit": 184.86, + # }, + # { + # "account": "Office Rent - _TIRC", + # "debit": 2677.64, # 500 * 3 + 499 * 2 + 179.64 + # "credit": 0.0, + # }, + # { + # "account": "CWIP Account - _TIRC", + # "debit": 2178.82, + # "credit": 0.0, + # }, # 1000 + 999 + 179.82 + # { + # "account": "Stock In Hand - _TIRC", + # "debit": 267.26, + # "credit": 0.0, + # }, # 20 * 5 + 19 * 3 + 100 * 1 + 10.26 + # {"account": "Creditors - _TIRC", "debit": 0.0, "credit": 5610.0}, + # ] + + # self.assertGLEntry(doc.name, expected_entries) + + # # Repost Item Valuation + # repost_doc = frappe.get_doc( + # { + # "doctype": "Repost Item Valuation", + # "voucher_type": "Purchase Invoice", + # "voucher_no": doc.name, + # "status": "Queued", + # } + # ) + # repost_doc.save() + # repost_doc.submit() + + # repost_entries() + + # status = frappe.db.get_value("Repost Item Valuation", repost_doc.name, "status") + # self.assertEqual(status, "Completed") + # self.assertGLEntry(doc.name, expected_entries) def test_purchase_invoice_with_ineligible_pos(self): transaction_details = { diff --git a/india_compliance/patches.txt b/india_compliance/patches.txt index c76921fb5..557d5f139 100644 --- a/india_compliance/patches.txt +++ b/india_compliance/patches.txt @@ -58,3 +58,4 @@ india_compliance.patches.v14.unset_inward_supply_link_for_cancelled_purchase india_compliance.patches.v14.delete_not_generated_gstr_import_log india_compliance.patches.v14.enable_sales_through_ecommerce_operator execute:from india_compliance.gst_india.setup import set_default_print_settings; set_default_print_settings() +execute:import frappe; frappe.db.set_single_value("GST Settings", "gstin_status_refresh_interval", 60)