Merge pull request #25105 from Anuja-pawar/fix_picked_qty_in_DN
fix: Picked Qty conversion from Stock Qty to Qty while creating DN from Pick List
This commit is contained in:
commit
ad75944960
@ -346,7 +346,7 @@ def create_delivery_note(source_name, target_doc=None):
|
||||
|
||||
if dn_item:
|
||||
dn_item.warehouse = location.warehouse
|
||||
dn_item.qty = location.picked_qty
|
||||
dn_item.qty = flt(location.picked_qty) / (flt(location.conversion_factor) or 1)
|
||||
dn_item.batch_no = location.batch_no
|
||||
dn_item.serial_no = location.serial_no
|
||||
|
||||
|
@ -9,6 +9,7 @@ test_dependencies = ['Item', 'Sales Invoice', 'Stock Entry', 'Batch']
|
||||
|
||||
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
|
||||
from erpnext.stock.doctype.item.test_item import create_item
|
||||
from erpnext.stock.doctype.pick_list.pick_list import create_delivery_note
|
||||
from erpnext.stock.doctype.stock_reconciliation.stock_reconciliation \
|
||||
import EmptyStockReconciliationItemsError
|
||||
|
||||
@ -291,6 +292,61 @@ class TestPickList(unittest.TestCase):
|
||||
self.assertEqual(pick_list.locations[1].qty, 5)
|
||||
self.assertEqual(pick_list.locations[1].sales_order_item, sales_order.items[0].name)
|
||||
|
||||
def test_pick_list_for_items_with_multiple_UOM(self):
|
||||
purchase_receipt = make_purchase_receipt(item_code="_Test Item", qty=10)
|
||||
purchase_receipt.submit()
|
||||
|
||||
sales_order = frappe.get_doc({
|
||||
'doctype': 'Sales Order',
|
||||
'customer': '_Test Customer',
|
||||
'company': '_Test Company',
|
||||
'items': [{
|
||||
'item_code': '_Test Item',
|
||||
'qty': 1,
|
||||
'conversion_factor': 5,
|
||||
'delivery_date': frappe.utils.today()
|
||||
}, {
|
||||
'item_code': '_Test Item',
|
||||
'qty': 1,
|
||||
'conversion_factor': 1,
|
||||
'delivery_date': frappe.utils.today()
|
||||
}],
|
||||
}).insert()
|
||||
sales_order.submit()
|
||||
|
||||
pick_list = frappe.get_doc({
|
||||
'doctype': 'Pick List',
|
||||
'company': '_Test Company',
|
||||
'customer': '_Test Customer',
|
||||
'items_based_on': 'Sales Order',
|
||||
'locations': [{
|
||||
'item_code': '_Test Item',
|
||||
'qty': 1,
|
||||
'stock_qty': 5,
|
||||
'conversion_factor': 5,
|
||||
'sales_order': sales_order.name,
|
||||
'sales_order_item': sales_order.items[0].name ,
|
||||
}, {
|
||||
'item_code': '_Test Item',
|
||||
'qty': 1,
|
||||
'stock_qty': 1,
|
||||
'conversion_factor': 1,
|
||||
'sales_order': sales_order.name,
|
||||
'sales_order_item': sales_order.items[1].name ,
|
||||
}]
|
||||
})
|
||||
pick_list.set_item_locations()
|
||||
pick_list.submit()
|
||||
|
||||
delivery_note = create_delivery_note(pick_list.name)
|
||||
|
||||
self.assertEqual(pick_list.locations[0].qty, delivery_note.items[0].qty)
|
||||
self.assertEqual(pick_list.locations[1].qty, delivery_note.items[1].qty)
|
||||
self.assertEqual(sales_order.items[0].conversion_factor, delivery_note.items[0].conversion_factor)
|
||||
|
||||
pick_list.cancel()
|
||||
sales_order.cancel()
|
||||
purchase_receipt.cancel()
|
||||
|
||||
# def test_pick_list_skips_items_in_expired_batch(self):
|
||||
# pass
|
||||
|
Loading…
x
Reference in New Issue
Block a user