Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: MR to PI with Shippinh rule, Sq and Adv Payment #1140

Merged
merged 2 commits into from
Jan 29, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 56 additions & 2 deletions erpnext/stock/doctype/material_request/test_material_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -4481,7 +4481,8 @@ def test_purchase_flow_TC_B_069(self):
"shipping_rule" :shipping_rule_name,
"supplier" : "_Test Supplier"
}
doc_sq = make_test_sq(doc_mr.name, type = "Material Request",args = args)
mr_rate = doc_mr.items[0].amount
doc_sq = make_test_sq(doc_mr.name, rate= mr_rate, type = "Material Request",args = args)
self.assertEqual(doc_sq.base_total_taxes_and_charges, 200)

doc_po = make_test_po(doc_sq.name, type="Supplier Quotation")
Expand Down Expand Up @@ -6001,6 +6002,60 @@ def test_mr_to_pi_with_partial_PE_TC_B_077(self):
self.assertEqual(doc_po.status, 'Completed')
self.assertEqual(doc_pi.status, 'Paid')

def test_mr_to_pi_TC_B_078(self):
#Scenario: MR=>SQ=>PO=>PE=>PR=>PI [With SQ, Shipping Rule and Shipping Rule]

args = {
"calculate_based_on" : "Fixed",
"shipping_amount" : 200
}
shipping_rule_name = get_shipping_rule_name(args)
mr_dict_list = {
"company" : "_Test Company",
"item_code" : "Testing-31",
"warehouse" : "Stores - _TC",
"qty" : 4,
"rate" : 3000,
}

doc_mr = make_material_request(**mr_dict_list)
self.assertEqual(doc_mr.docstatus, 1)

args = {
"shipping_rule" :shipping_rule_name,
"supplier" : "_Test Supplier"
}
mr_rate = doc_mr.items[0].amount
doc_sq = make_test_sq(doc_mr.name, rate= mr_rate,type = "Material Request",args = args)
self.assertEqual(doc_sq.base_total_taxes_and_charges, 200)

doc_po = make_test_po(doc_sq.name, type="Supplier Quotation")

args = {
"mode_of_payment" : "Cash",
"reference_no" : "For Testing"
}

doc_pe = make_payment_entry(doc_po.doctype, doc_po.name, doc_po.grand_total, args)
self.assertEqual(doc_po.base_total_taxes_and_charges, 200)

doc_pr = make_test_pr(doc_po.name)

args = {
"is_paid" : 1,
"mode_of_payment" : 'Cash',
"cash_bank_account" : doc_pe.paid_from,
"paid_amount" : doc_pe.base_received_amount
}

doc_pi = make_test_pi(doc_pr.name, args = args)

self.assertEqual(doc_pi.docstatus, 1)

doc_po.reload()
self.assertEqual(doc_po.status, 'Completed')
self.assertEqual(doc_pi.status, 'Paid')

def test_create_material_req_serial_to_2po_to_2pr_TC_SCK_192(self):
company = "_Test Company"
warehouse = "Stores - _TC"
Expand Down Expand Up @@ -6576,4 +6631,3 @@ def get_shipping_rule_name(args = None):
from erpnext.accounts.doctype.shipping_rule.test_shipping_rule import create_shipping_rule
doc_shipping_rule = create_shipping_rule("Buying", "_Test Shipping Rule -TC", args)
return doc_shipping_rule.name

Loading