Skip to content

Commit

Permalink
Merge pull request #2567 from resilient-tech/mergify/bp/version-15-ho…
Browse files Browse the repository at this point in the history
…tfix/pr-2561

fix: value should not be changed after doc is submitted (backport #2561)
  • Loading branch information
mergify[bot] authored Aug 24, 2024
2 parents 2ad87c9 + 2bcd11b commit d08fa79
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 1 deletion.
6 changes: 6 additions & 0 deletions india_compliance/gst_india/constants/custom_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@
"insert_after": "bill_from_address",
"read_only": 1,
"is_virtual": 1,
"allow_on_submit": 1,
},
{
"fieldname": "bill_from_gstin",
Expand Down Expand Up @@ -256,6 +257,7 @@
"insert_after": "bill_to_address",
"read_only": 1,
"is_virtual": 1,
"allow_on_submit": 1,
},
{
"fieldname": "bill_to_gstin",
Expand Down Expand Up @@ -310,6 +312,7 @@
"insert_after": "ship_from_address",
"read_only": 1,
"is_virtual": 1,
"allow_on_submit": 1,
},
{
"fieldname": "cb_shipping_address",
Expand All @@ -331,6 +334,7 @@
"insert_after": "ship_to_address",
"read_only": 1,
"is_virtual": 1,
"allow_on_submit": 1,
},
{
"fieldname": "section_break_ref_doc",
Expand Down Expand Up @@ -541,6 +545,7 @@
"translatable": 0,
"is_virtual": 1,
"read_only": 1,
"allow_on_submit": 1,
},
{
"fieldname": "gst_col_break",
Expand Down Expand Up @@ -1088,6 +1093,7 @@
"print_hide": 1,
"translatable": 0,
"is_virtual": 1,
"allow_on_submit": 1,
},
],
"Supplier": [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
from frappe.tests.utils import FrappeTestCase

from india_compliance.gst_india.utils.tests import create_transaction


class TestSubcontractingTransaction(FrappeTestCase):
def test_create_and_update_stock_entry(self):
# Create a subcontracting transaction
args = {
"stock_entry_type": "Send to Subcontractor",
"purpose": "Send to Subcontractor",
"bill_from_address": "_Test Indian Registered Company-Billing",
"bill_to_address": "_Test Registered Supplier-Billing",
"items": [
{
"item_code": "_Test Trading Goods 1",
"qty": 1,
"gst_hsn_code": "61149090",
"s_warehouse": "Finished Goods - _TIRC",
"t_warehouse": "Goods In Transit - _TIRC",
"amount": 100,
"taxable_value": 100,
}
],
"company": "_Test Indian Registered Company",
"base_grand_total": 100,
}

stock_entry = self._create_stock_entry(args)

# Update the subcontracting transaction
stock_entry.run_method("onload") # update virtual fields
stock_entry.select_print_heading = "Credit Note"
stock_entry.save()

self.assertEqual(stock_entry.select_print_heading, "Credit Note")

def _create_stock_entry(self, doc_args):
"""Generate Stock Entry to test e-Waybill functionalities"""
doc_args.update({"doctype": "Stock Entry"})

stock_entry = create_transaction(**doc_args)
return stock_entry
2 changes: 1 addition & 1 deletion india_compliance/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ india_compliance.patches.v15.remove_duplicate_web_template

[post_model_sync]
india_compliance.patches.v14.set_default_for_overridden_accounts_setting
execute:from india_compliance.gst_india.setup import create_custom_fields; create_custom_fields() #54
execute:from india_compliance.gst_india.setup import create_custom_fields; create_custom_fields() #55
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() #1
india_compliance.patches.post_install.remove_old_fields #1
Expand Down

0 comments on commit d08fa79

Please sign in to comment.