mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-21 07:38:29 +00:00
fix: stock entry repack amount calculation
(cherry picked from commit 544ceb93cd)
# Conflicts:
# erpnext/stock/stock_ledger.py
This commit is contained in:
committed by
Mergify
parent
4ac5c7e5e7
commit
253a067592
@@ -1835,6 +1835,59 @@ class TestStockEntry(FrappeTestCase):
|
|||||||
self.assertEqual(sle.stock_value_difference, 100)
|
self.assertEqual(sle.stock_value_difference, 100)
|
||||||
self.assertEqual(sle.stock_value, 100 * i)
|
self.assertEqual(sle.stock_value, 100 * i)
|
||||||
|
|
||||||
|
def test_stock_entry_amount(self):
|
||||||
|
warehouse = "_Test Warehouse - _TC"
|
||||||
|
rm_item_code = "Test Stock Entry Amount 1"
|
||||||
|
make_item(rm_item_code, {"is_stock_item": 1})
|
||||||
|
|
||||||
|
fg_item_code = "Test Repack Stock Entry Amount 1"
|
||||||
|
make_item(fg_item_code, {"is_stock_item": 1})
|
||||||
|
|
||||||
|
make_stock_entry(
|
||||||
|
item_code=rm_item_code,
|
||||||
|
qty=1,
|
||||||
|
to_warehouse=warehouse,
|
||||||
|
basic_rate=200,
|
||||||
|
posting_date=nowdate(),
|
||||||
|
)
|
||||||
|
|
||||||
|
se = make_stock_entry(
|
||||||
|
item_code=rm_item_code,
|
||||||
|
qty=1,
|
||||||
|
purpose="Repack",
|
||||||
|
basic_rate=100,
|
||||||
|
do_not_save=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
se.items[0].s_warehouse = warehouse
|
||||||
|
se.append(
|
||||||
|
"items",
|
||||||
|
{
|
||||||
|
"item_code": fg_item_code,
|
||||||
|
"qty": 1,
|
||||||
|
"t_warehouse": warehouse,
|
||||||
|
"uom": "Nos",
|
||||||
|
"conversion_factor": 1.0,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
se.set_stock_entry_type()
|
||||||
|
se.submit()
|
||||||
|
|
||||||
|
self.assertEqual(se.items[0].amount, 200)
|
||||||
|
self.assertEqual(se.items[0].basic_amount, 200)
|
||||||
|
|
||||||
|
make_stock_entry(
|
||||||
|
item_code=rm_item_code,
|
||||||
|
qty=1,
|
||||||
|
to_warehouse=warehouse,
|
||||||
|
basic_rate=300,
|
||||||
|
posting_date=add_days(nowdate(), -1),
|
||||||
|
)
|
||||||
|
|
||||||
|
se.reload()
|
||||||
|
self.assertEqual(se.items[0].amount, 300)
|
||||||
|
self.assertEqual(se.items[0].basic_amount, 300)
|
||||||
|
|
||||||
|
|
||||||
def make_serialized_item(**args):
|
def make_serialized_item(**args):
|
||||||
args = frappe._dict(args)
|
args = frappe._dict(args)
|
||||||
|
|||||||
@@ -864,7 +864,16 @@ class update_entries_after:
|
|||||||
stock_entry.calculate_rate_and_amount(reset_outgoing_rate=False, raise_error_if_no_rate=False)
|
stock_entry.calculate_rate_and_amount(reset_outgoing_rate=False, raise_error_if_no_rate=False)
|
||||||
stock_entry.db_update()
|
stock_entry.db_update()
|
||||||
for d in stock_entry.items:
|
for d in stock_entry.items:
|
||||||
|
<<<<<<< HEAD
|
||||||
if d.name == voucher_detail_no or (not d.s_warehouse and d.t_warehouse):
|
if d.name == voucher_detail_no or (not d.s_warehouse and d.t_warehouse):
|
||||||
|
=======
|
||||||
|
# Update only the row that matches the voucher_detail_no or the row containing the FG/Scrap Item.
|
||||||
|
if (
|
||||||
|
d.name == voucher_detail_no
|
||||||
|
or (not d.s_warehouse and d.t_warehouse)
|
||||||
|
or stock_entry.purpose in ["Manufacture", "Repack"]
|
||||||
|
):
|
||||||
|
>>>>>>> 544ceb93cd (fix: stock entry repack amount calculation)
|
||||||
d.db_update()
|
d.db_update()
|
||||||
|
|
||||||
def update_rate_on_delivery_and_sales_return(self, sle, outgoing_rate):
|
def update_rate_on_delivery_and_sales_return(self, sle, outgoing_rate):
|
||||||
|
|||||||
Reference in New Issue
Block a user