mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-28 11:08:32 +00:00
fix: extra qty pick in pick list (#42345)
(cherry picked from commit 6a50b40976)
Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
This commit is contained in:
@@ -603,6 +603,17 @@ class SalesOrder(SellingController):
|
|||||||
if total_picked_qty and total_qty:
|
if total_picked_qty and total_qty:
|
||||||
per_picked = total_picked_qty / total_qty * 100
|
per_picked = total_picked_qty / total_qty * 100
|
||||||
|
|
||||||
|
pick_percentage = frappe.db.get_single_value("Stock Settings", "over_picking_allowance")
|
||||||
|
if pick_percentage:
|
||||||
|
total_qty += flt(total_qty) * (pick_percentage / 100)
|
||||||
|
|
||||||
|
if total_picked_qty > total_qty:
|
||||||
|
frappe.throw(
|
||||||
|
_(
|
||||||
|
"Total Picked Quantity {0} is more than ordered qty {1}. You can set the Over Picking Allowance in Stock Settings."
|
||||||
|
).format(total_picked_qty, total_qty)
|
||||||
|
)
|
||||||
|
|
||||||
self.db_set("per_picked", flt(per_picked), update_modified=False)
|
self.db_set("per_picked", flt(per_picked), update_modified=False)
|
||||||
|
|
||||||
def set_indicator(self):
|
def set_indicator(self):
|
||||||
|
|||||||
@@ -1174,3 +1174,34 @@ class TestPickList(FrappeTestCase):
|
|||||||
row.qty = row.qty + 10
|
row.qty = row.qty + 10
|
||||||
|
|
||||||
self.assertRaises(frappe.ValidationError, pl.save)
|
self.assertRaises(frappe.ValidationError, pl.save)
|
||||||
|
|
||||||
|
def test_over_allowance_picking(self):
|
||||||
|
warehouse = "_Test Warehouse - _TC"
|
||||||
|
item = make_item(
|
||||||
|
"Test Over Allowance Picking Item",
|
||||||
|
properties={
|
||||||
|
"is_stock_item": 1,
|
||||||
|
},
|
||||||
|
).name
|
||||||
|
|
||||||
|
make_stock_entry(item=item, to_warehouse=warehouse, qty=100)
|
||||||
|
|
||||||
|
so = make_sales_order(item_code=item, qty=10, rate=100)
|
||||||
|
|
||||||
|
pl_doc = create_pick_list(so.name)
|
||||||
|
pl_doc.save()
|
||||||
|
self.assertEqual(pl_doc.locations[0].qty, 10)
|
||||||
|
|
||||||
|
pl_doc.locations[0].qty = 15
|
||||||
|
pl_doc.locations[0].stock_qty = 15
|
||||||
|
pl_doc.save()
|
||||||
|
|
||||||
|
self.assertEqual(pl_doc.locations[0].qty, 15)
|
||||||
|
self.assertRaises(frappe.ValidationError, pl_doc.submit)
|
||||||
|
|
||||||
|
frappe.db.set_single_value("Stock Settings", "over_picking_allowance", 50)
|
||||||
|
|
||||||
|
pl_doc.reload()
|
||||||
|
pl_doc.submit()
|
||||||
|
|
||||||
|
frappe.db.set_single_value("Stock Settings", "over_picking_allowance", 0)
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
"section_break_9",
|
"section_break_9",
|
||||||
"over_delivery_receipt_allowance",
|
"over_delivery_receipt_allowance",
|
||||||
"mr_qty_allowance",
|
"mr_qty_allowance",
|
||||||
|
"over_picking_allowance",
|
||||||
"column_break_121",
|
"column_break_121",
|
||||||
"role_allowed_to_over_deliver_receive",
|
"role_allowed_to_over_deliver_receive",
|
||||||
"allow_negative_stock",
|
"allow_negative_stock",
|
||||||
@@ -446,6 +447,12 @@
|
|||||||
"fieldname": "do_not_use_batchwise_valuation",
|
"fieldname": "do_not_use_batchwise_valuation",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Do Not Use Batch-wise Valuation"
|
"label": "Do Not Use Batch-wise Valuation"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "The percentage you are allowed to pick more items in the pick list than the ordered quantity.",
|
||||||
|
"fieldname": "over_picking_allowance",
|
||||||
|
"fieldtype": "Percent",
|
||||||
|
"label": "Over Picking Allowance"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "icon-cog",
|
"icon": "icon-cog",
|
||||||
@@ -453,7 +460,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2024-07-04 12:45:09.811280",
|
"modified": "2024-07-15 17:18:23.872161",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Stock Settings",
|
"name": "Stock Settings",
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ class StockSettings(Document):
|
|||||||
mr_qty_allowance: DF.Float
|
mr_qty_allowance: DF.Float
|
||||||
naming_series_prefix: DF.Data | None
|
naming_series_prefix: DF.Data | None
|
||||||
over_delivery_receipt_allowance: DF.Float
|
over_delivery_receipt_allowance: DF.Float
|
||||||
|
over_picking_allowance: DF.Percent
|
||||||
pick_serial_and_batch_based_on: DF.Literal["FIFO", "LIFO", "Expiry"]
|
pick_serial_and_batch_based_on: DF.Literal["FIFO", "LIFO", "Expiry"]
|
||||||
reorder_email_notify: DF.Check
|
reorder_email_notify: DF.Check
|
||||||
role_allowed_to_create_edit_back_dated_transactions: DF.Link | None
|
role_allowed_to_create_edit_back_dated_transactions: DF.Link | None
|
||||||
|
|||||||
Reference in New Issue
Block a user