fix: only auto-set serial nos and batches if allowed in Stock Settings (develop) (#21781)
* fix: only auto-set serial nos and batches if allowed in Stock Settings * fix: bug with setting disabled batch no in Pick List * fix: remove auto-set batch variable Co-authored-by: Marica <maricadsouza221197@gmail.com>
This commit is contained in:
parent
526132d60a
commit
d60d2e1826
@ -119,11 +119,13 @@ def get_items_with_location_and_quantity(item_doc, item_location_map):
|
|||||||
if item_location.serial_no:
|
if item_location.serial_no:
|
||||||
serial_nos = '\n'.join(item_location.serial_no[0: cint(stock_qty)])
|
serial_nos = '\n'.join(item_location.serial_no[0: cint(stock_qty)])
|
||||||
|
|
||||||
|
auto_set_serial_no = frappe.db.get_single_value("Stock Settings", "automatically_set_serial_nos_based_on_fifo")
|
||||||
|
|
||||||
locations.append(frappe._dict({
|
locations.append(frappe._dict({
|
||||||
'qty': qty,
|
'qty': qty,
|
||||||
'stock_qty': stock_qty,
|
'stock_qty': stock_qty,
|
||||||
'warehouse': item_location.warehouse,
|
'warehouse': item_location.warehouse,
|
||||||
'serial_no': serial_nos,
|
'serial_no': serial_nos if auto_set_serial_no else item_doc.serial_no,
|
||||||
'batch_no': item_location.batch_no
|
'batch_no': item_location.batch_no
|
||||||
}))
|
}))
|
||||||
|
|
||||||
@ -206,6 +208,7 @@ def get_available_item_locations_for_batched_item(item_code, from_warehouses, re
|
|||||||
sle.batch_no = batch.name
|
sle.batch_no = batch.name
|
||||||
and sle.`item_code`=%(item_code)s
|
and sle.`item_code`=%(item_code)s
|
||||||
and sle.`company` = %(company)s
|
and sle.`company` = %(company)s
|
||||||
|
and batch.disabled = 0
|
||||||
and IFNULL(batch.`expiry_date`, '2200-01-01') > %(today)s
|
and IFNULL(batch.`expiry_date`, '2200-01-01') > %(today)s
|
||||||
{warehouse_condition}
|
{warehouse_condition}
|
||||||
GROUP BY
|
GROUP BY
|
||||||
@ -471,4 +474,4 @@ def update_common_item_properties(item, location):
|
|||||||
item.material_request = location.material_request
|
item.material_request = location.material_request
|
||||||
item.serial_no = location.serial_no
|
item.serial_no = location.serial_no
|
||||||
item.batch_no = location.batch_no
|
item.batch_no = location.batch_no
|
||||||
item.material_request_item = location.material_request_item
|
item.material_request_item = location.material_request_item
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user