-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2682 from resilient-tech/mergify/bp/version-15-ho…
…tfix/pr-2656 fix: add comment in gst return log for backdated transactions (backport #2656)
- Loading branch information
Showing
6 changed files
with
123 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
|
||
import frappe | ||
from frappe.tests.utils import FrappeTestCase, change_settings | ||
from frappe.utils import today | ||
from frappe.utils import add_days, getdate, today | ||
from erpnext.accounts.doctype.purchase_invoice.purchase_invoice import ( | ||
make_regional_gl_entries, | ||
) | ||
|
@@ -931,6 +931,10 @@ def get_lead(first_name): | |
|
||
|
||
class TestSpecificTransactions(FrappeTestCase): | ||
@classmethod | ||
def tearDown(cls): | ||
frappe.db.rollback() | ||
|
||
def test_copy_e_waybill_fields_from_dn_to_si(self): | ||
"Make sure e-Waybill fields are copied from Delivery Note to Sales Invoice" | ||
dn = create_transaction(doctype="Delivery Note", vehicle_no="GJ01AA1111") | ||
|
@@ -945,6 +949,63 @@ def test_copy_e_waybill_fields_from_si_to_return(self): | |
|
||
self.assertEqual(si_return.vehicle_no, None) | ||
|
||
@change_settings("GST Settings", {"restrict_changes_after_gstr_1": 1}) | ||
def test_backdated_transaction(self): | ||
si = create_transaction(doctype="Sales Invoice", do_not_submit=True) | ||
|
||
# update filing date | ||
gstin_doc = frappe.new_doc( | ||
"GSTIN", | ||
gstin=si.company_gstin, | ||
status="Active", | ||
gstr_1_filed_upto=add_days(today(), 1), | ||
) | ||
gstin_doc.save(ignore_permissions=True) | ||
|
||
# create user | ||
test_user = frappe.get_doc("User", {"email": "[email protected]"}) | ||
test_user.add_roles("Accounts User") | ||
frappe.set_user(test_user.name) | ||
|
||
# submit invoice | ||
self.assertRaisesRegex( | ||
frappe.exceptions.ValidationError, | ||
re.compile(r"You are not allowed to submit Sales Invoice"), | ||
si.submit, | ||
) | ||
|
||
def test_backdated_transaction_with_comment(self): | ||
si = create_transaction(doctype="Sales Invoice", do_not_submit=True) | ||
|
||
# create filing log | ||
posting_date = getdate(si.posting_date) | ||
gst_return_log = frappe.new_doc( | ||
"GST Return Log", | ||
return_period=f"{posting_date.month:02d}{posting_date.year}", | ||
gstin=si.company_gstin, | ||
return_type="GSTR1", | ||
) | ||
gst_return_log.save() | ||
|
||
# update filing date | ||
gstin_doc = frappe.new_doc( | ||
"GSTIN", | ||
gstin=si.company_gstin, | ||
status="Active", | ||
gstr_1_filed_upto=add_days(today(), 1), | ||
) | ||
gstin_doc.save(ignore_permissions=True) | ||
|
||
# submit invoice | ||
si.submit() | ||
|
||
comment = frappe.get_value( | ||
"Comment", | ||
{"comment_type": "Comment", "reference_name": gst_return_log.name}, | ||
["content"], | ||
) | ||
self.assertTrue(si.name in comment) | ||
|
||
|
||
def create_cess_accounts(): | ||
input_cess_non_advol_account = create_tax_accounts("Input Tax Cess Non Advol") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters