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:
Rohan 2020-06-10 19:10:56 +05:30 committed by GitHub
parent 526132d60a
commit d60d2e1826
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -119,11 +119,13 @@ def get_items_with_location_and_quantity(item_doc, item_location_map):
if item_location.serial_no:
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({
'qty': qty,
'stock_qty': stock_qty,
'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
}))
@ -206,6 +208,7 @@ def get_available_item_locations_for_batched_item(item_code, from_warehouses, re
sle.batch_no = batch.name
and sle.`item_code`=%(item_code)s
and sle.`company` = %(company)s
and batch.disabled = 0
and IFNULL(batch.`expiry_date`, '2200-01-01') > %(today)s
{warehouse_condition}
GROUP BY
@ -471,4 +474,4 @@ def update_common_item_properties(item, location):
item.material_request = location.material_request
item.serial_no = location.serial_no
item.batch_no = location.batch_no
item.material_request_item = location.material_request_item
item.material_request_item = location.material_request_item