mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-01 07:37:04 +00:00
feat: create sales invoice from pick list (#55594)
* feat: create sales invoice from pick list * test: cover sales invoice creation from pick list * fix: require update stock for pick list invoices * fix: return SI should not bother with pick list
This commit is contained in:
@@ -1062,6 +1062,44 @@ class SellingController(StockController):
|
||||
|
||||
qty_to_undelivered -= qty_can_be_undelivered
|
||||
|
||||
def set_serial_and_batch_bundle_from_pick_list(self):
|
||||
from erpnext.stock.serial_batch_bundle import SerialBatchCreation
|
||||
|
||||
for item in self.items:
|
||||
if item.use_serial_batch_fields or not item.against_pick_list or not self.get("update_stock", 1):
|
||||
continue
|
||||
|
||||
if item.pick_list_item and not item.serial_and_batch_bundle:
|
||||
filters = {
|
||||
"item_code": item.item_code,
|
||||
"voucher_type": "Pick List",
|
||||
"voucher_no": item.against_pick_list,
|
||||
"voucher_detail_no": item.pick_list_item,
|
||||
}
|
||||
|
||||
bundle_id = frappe.db.get_value("Serial and Batch Bundle", filters, "name")
|
||||
|
||||
if bundle_id:
|
||||
cls_obj = SerialBatchCreation(
|
||||
{
|
||||
"type_of_transaction": "Outward",
|
||||
"serial_and_batch_bundle": bundle_id,
|
||||
"item_code": item.get("item_code"),
|
||||
"warehouse": item.get("warehouse"),
|
||||
}
|
||||
)
|
||||
|
||||
cls_obj.duplicate_package()
|
||||
|
||||
item.serial_and_batch_bundle = cls_obj.serial_and_batch_bundle
|
||||
|
||||
def update_pick_list_status(self):
|
||||
from erpnext.stock.doctype.pick_list.pick_list import update_pick_list_status
|
||||
|
||||
pick_lists = {row.against_pick_list for row in self.items if row.against_pick_list}
|
||||
for pick_list in pick_lists:
|
||||
update_pick_list_status(pick_list)
|
||||
|
||||
|
||||
def set_default_income_account_for_item(obj):
|
||||
"""Set income account as default for items in the transaction.
|
||||
|
||||
Reference in New Issue
Block a user