Skip to content

Commit

Permalink
Merge pull request #1140 from 8848digital/tc_buy_mod
Browse files Browse the repository at this point in the history
test: MR to PI with Shippinh rule, Sq and Adv Payment
  • Loading branch information
aasif-patel authored Jan 29, 2025
2 parents cbcd347 + c1b3e31 commit eefe869
Showing 1 changed file with 56 additions and 2 deletions.
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

0 comments on commit eefe869

Please sign in to comment.