mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-01 12:38:27 +00:00
fix: SABB not cancelled on cancel of Stock Reco
(cherry picked from commit b204853193)
This commit is contained in:
committed by
Mergify
parent
02203ca534
commit
eebd88529f
@@ -879,7 +879,7 @@ class StockReconciliation(StockController):
|
|||||||
if row.get(dimension.get("fieldname")):
|
if row.get(dimension.get("fieldname")):
|
||||||
has_dimensions = True
|
has_dimensions = True
|
||||||
|
|
||||||
if self.docstatus == 2 and (not row.batch_no or not row.serial_and_batch_bundle):
|
if self.docstatus == 2:
|
||||||
if row.current_qty and current_bundle:
|
if row.current_qty and current_bundle:
|
||||||
data.actual_qty = -1 * row.current_qty
|
data.actual_qty = -1 * row.current_qty
|
||||||
data.qty_after_transaction = flt(row.current_qty)
|
data.qty_after_transaction = flt(row.current_qty)
|
||||||
|
|||||||
@@ -1645,6 +1645,59 @@ class TestStockReconciliation(FrappeTestCase, StockTestMixin):
|
|||||||
batch_qty = get_batch_qty(batch_no, warehouse, item_code)
|
batch_qty = get_batch_qty(batch_no, warehouse, item_code)
|
||||||
self.assertEqual(batch_qty, 4)
|
self.assertEqual(batch_qty, 4)
|
||||||
|
|
||||||
|
def test_sabb_cancel_on_stock_reco_cancellation(self):
|
||||||
|
item_code = self.make_item(
|
||||||
|
"Test Item for SABB Cancel on Stock Reco Cancellation",
|
||||||
|
{
|
||||||
|
"is_stock_item": 1,
|
||||||
|
"has_batch_no": 1,
|
||||||
|
"create_new_batch": 1,
|
||||||
|
"batch_number_series": "TEST-BATCH-SABBCANC-.###",
|
||||||
|
},
|
||||||
|
).name
|
||||||
|
|
||||||
|
warehouse = "_Test Warehouse - _TC"
|
||||||
|
|
||||||
|
sr = create_stock_reconciliation(
|
||||||
|
item_code=item_code,
|
||||||
|
warehouse=warehouse,
|
||||||
|
qty=10,
|
||||||
|
rate=100,
|
||||||
|
use_serial_batch_fields=1,
|
||||||
|
)
|
||||||
|
|
||||||
|
sr.reload()
|
||||||
|
|
||||||
|
batch_no = get_batch_from_bundle(sr.items[0].serial_and_batch_bundle)
|
||||||
|
|
||||||
|
sr1 = create_stock_reconciliation(
|
||||||
|
item_code=item_code,
|
||||||
|
warehouse=warehouse,
|
||||||
|
qty=20,
|
||||||
|
rate=100,
|
||||||
|
use_serial_batch_fields=1,
|
||||||
|
batch_no=batch_no,
|
||||||
|
)
|
||||||
|
|
||||||
|
sr1.reload()
|
||||||
|
|
||||||
|
current_serial_and_batch_bundle = sr1.items[0].current_serial_and_batch_bundle
|
||||||
|
serial_and_batch_bundle = sr1.items[0].serial_and_batch_bundle
|
||||||
|
|
||||||
|
self.assertTrue(current_serial_and_batch_bundle)
|
||||||
|
self.assertTrue(serial_and_batch_bundle)
|
||||||
|
|
||||||
|
sr1.cancel()
|
||||||
|
|
||||||
|
for sabb in [serial_and_batch_bundle, current_serial_and_batch_bundle]:
|
||||||
|
docstatus = frappe.db.get_value(
|
||||||
|
"Serial and Batch Bundle",
|
||||||
|
sabb,
|
||||||
|
"docstatus",
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertEqual(docstatus, 2)
|
||||||
|
|
||||||
|
|
||||||
def create_batch_item_with_batch(item_name, batch_id):
|
def create_batch_item_with_batch(item_name, batch_id):
|
||||||
batch_item_doc = create_item(item_name, is_stock_item=1)
|
batch_item_doc = create_item(item_name, is_stock_item=1)
|
||||||
|
|||||||
Reference in New Issue
Block a user