-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: creation of stock entry and update after submit
(cherry picked from commit be69852)
- Loading branch information
1 parent
a5d4862
commit 2bcd11b
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
india_compliance/gst_india/overrides/test_subcontracting_transaction.py
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 |
---|---|---|
@@ -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 |