mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-21 05:59:18 +00:00
fix: update total in words after updating items (#24602)
* fix: Update total in words after Updating items Update total in words after Updating items in sales/purchase orders. Port of #24592 Closes ISS-20-21-09425 * test: Add test for total & words after update item Add test for total & words after updating items in sales order.
This commit is contained in:
@@ -1503,6 +1503,7 @@ def update_child_qty_rate(parent_doctype, trans_items, parent_doctype_name, chil
|
|||||||
parent.flags.ignore_validate_update_after_submit = True
|
parent.flags.ignore_validate_update_after_submit = True
|
||||||
parent.set_qty_as_per_stock_uom()
|
parent.set_qty_as_per_stock_uom()
|
||||||
parent.calculate_taxes_and_totals()
|
parent.calculate_taxes_and_totals()
|
||||||
|
parent.set_total_in_words()
|
||||||
if parent_doctype == "Sales Order":
|
if parent_doctype == "Sales Order":
|
||||||
make_packing_list(parent)
|
make_packing_list(parent)
|
||||||
parent.set_gross_profit()
|
parent.set_gross_profit()
|
||||||
|
|||||||
@@ -325,6 +325,9 @@ class TestSalesOrder(unittest.TestCase):
|
|||||||
create_dn_against_so(so.name, 4)
|
create_dn_against_so(so.name, 4)
|
||||||
make_sales_invoice(so.name)
|
make_sales_invoice(so.name)
|
||||||
|
|
||||||
|
prev_total = so.get("base_total")
|
||||||
|
prev_total_in_words = so.get("base_in_words")
|
||||||
|
|
||||||
first_item_of_so = so.get("items")[0]
|
first_item_of_so = so.get("items")[0]
|
||||||
trans_item = json.dumps([
|
trans_item = json.dumps([
|
||||||
{'item_code' : first_item_of_so.item_code, 'rate' : first_item_of_so.rate, \
|
{'item_code' : first_item_of_so.item_code, 'rate' : first_item_of_so.rate, \
|
||||||
@@ -340,6 +343,12 @@ class TestSalesOrder(unittest.TestCase):
|
|||||||
self.assertEqual(so.get("items")[-1].amount, 1400)
|
self.assertEqual(so.get("items")[-1].amount, 1400)
|
||||||
self.assertEqual(so.status, 'To Deliver and Bill')
|
self.assertEqual(so.status, 'To Deliver and Bill')
|
||||||
|
|
||||||
|
updated_total = so.get("base_total")
|
||||||
|
updated_total_in_words = so.get("base_in_words")
|
||||||
|
|
||||||
|
self.assertEqual(updated_total, prev_total+1400)
|
||||||
|
self.assertNotEqual(updated_total_in_words, prev_total_in_words)
|
||||||
|
|
||||||
def test_update_child_removing_item(self):
|
def test_update_child_removing_item(self):
|
||||||
so = make_sales_order(**{
|
so = make_sales_order(**{
|
||||||
"item_list": [{
|
"item_list": [{
|
||||||
|
|||||||
Reference in New Issue
Block a user