mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-05 06:28:29 +00:00
fix: TypeError: 'float' object is not iterable (#41758)
This commit is contained in:
@@ -562,6 +562,7 @@ def add_sub_assembly(**kwargs):
|
|||||||
"source_warehouse": bom_item.source_warehouse,
|
"source_warehouse": bom_item.source_warehouse,
|
||||||
"wip_warehouse": bom_item.wip_warehouse,
|
"wip_warehouse": bom_item.wip_warehouse,
|
||||||
"fg_warehouse": bom_item.fg_warehouse,
|
"fg_warehouse": bom_item.fg_warehouse,
|
||||||
|
"skip_material_transfer": bom_item.skip_material_transfer,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -548,6 +548,7 @@ class BOMConfigurator {
|
|||||||
label: __("Is Subcontracted"),
|
label: __("Is Subcontracted"),
|
||||||
fieldname: "is_subcontracted",
|
fieldname: "is_subcontracted",
|
||||||
fieldtype: "Check",
|
fieldtype: "Check",
|
||||||
|
hidden: node?.is_root || 0,
|
||||||
default: data.is_subcontracted,
|
default: data.is_subcontracted,
|
||||||
},
|
},
|
||||||
{ fieldtype: "Column Break" },
|
{ fieldtype: "Column Break" },
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ from collections import defaultdict
|
|||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.query_builder.functions import CombineDatetime
|
from frappe.query_builder.functions import CombineDatetime, Sum
|
||||||
from frappe.utils import cint, flt
|
from frappe.utils import cint, flt
|
||||||
|
|
||||||
from erpnext.stock.doctype.inventory_dimension.inventory_dimension import get_inventory_dimensions
|
from erpnext.stock.doctype.inventory_dimension.inventory_dimension import get_inventory_dimensions
|
||||||
@@ -69,12 +69,12 @@ def execute(filters=None):
|
|||||||
stock_value += sle.stock_value_difference
|
stock_value += sle.stock_value_difference
|
||||||
if sle.batch_no:
|
if sle.batch_no:
|
||||||
if not batch_balance_dict.get(sle.batch_no):
|
if not batch_balance_dict.get(sle.batch_no):
|
||||||
batch_balance_dict[sle.batch_no] = 0
|
batch_balance_dict[sle.batch_no] = [0, 0]
|
||||||
|
|
||||||
batch_balance_dict[sle.batch_no] += sle.actual_qty
|
batch_balance_dict[sle.batch_no][0] += sle.actual_qty
|
||||||
|
|
||||||
if filters.get("segregate_serial_batch_bundle"):
|
if filters.get("segregate_serial_batch_bundle"):
|
||||||
actual_qty = batch_balance_dict[sle.batch_no]
|
actual_qty = batch_balance_dict[sle.batch_no][0]
|
||||||
|
|
||||||
if sle.voucher_type == "Stock Reconciliation" and not sle.actual_qty:
|
if sle.voucher_type == "Stock Reconciliation" and not sle.actual_qty:
|
||||||
actual_qty = sle.qty_after_transaction
|
actual_qty = sle.qty_after_transaction
|
||||||
@@ -530,7 +530,9 @@ def get_opening_balance_from_batch(filters, columns, sl_entries):
|
|||||||
query_filters = {
|
query_filters = {
|
||||||
"batch_no": filters.batch_no,
|
"batch_no": filters.batch_no,
|
||||||
"docstatus": 1,
|
"docstatus": 1,
|
||||||
|
"is_cancelled": 0,
|
||||||
"posting_date": ("<", filters.from_date),
|
"posting_date": ("<", filters.from_date),
|
||||||
|
"company": filters.company,
|
||||||
}
|
}
|
||||||
|
|
||||||
for fields in ["item_code", "warehouse"]:
|
for fields in ["item_code", "warehouse"]:
|
||||||
@@ -547,25 +549,30 @@ def get_opening_balance_from_batch(filters, columns, sl_entries):
|
|||||||
if opening_data.get(field) is None:
|
if opening_data.get(field) is None:
|
||||||
opening_data[field] = 0.0
|
opening_data[field] = 0.0
|
||||||
|
|
||||||
query_filters = [
|
table = frappe.qb.DocType("Stock Ledger Entry")
|
||||||
["Serial and Batch Entry", "batch_no", "=", filters.batch_no],
|
sabb_table = frappe.qb.DocType("Serial and Batch Entry")
|
||||||
["Serial and Batch Bundle", "docstatus", "=", 1],
|
query = (
|
||||||
["Serial and Batch Bundle", "posting_date", "<", filters.from_date],
|
frappe.qb.from_(table)
|
||||||
]
|
.inner_join(sabb_table)
|
||||||
|
.on(table.serial_and_batch_bundle == sabb_table.parent)
|
||||||
for fields in ["item_code", "warehouse"]:
|
.select(
|
||||||
if filters.get(fields):
|
Sum(sabb_table.qty).as_("qty"),
|
||||||
query_filters.append(["Serial and Batch Bundle", fields, "=", filters.get(fields)])
|
Sum(sabb_table.stock_value_difference).as_("stock_value"),
|
||||||
|
)
|
||||||
bundle_data = frappe.get_all(
|
.where(
|
||||||
"Serial and Batch Bundle",
|
(sabb_table.batch_no == filters.batch_no)
|
||||||
fields=[
|
& (sabb_table.docstatus == 1)
|
||||||
"sum(`tabSerial and Batch Entry`.`qty`) as qty",
|
& (table.posting_date < filters.from_date)
|
||||||
"sum(`tabSerial and Batch Entry`.`stock_value_difference`) as stock_value",
|
& (table.is_cancelled == 0)
|
||||||
],
|
)
|
||||||
filters=query_filters,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
for field in ["item_code", "warehouse", "company"]:
|
||||||
|
if filters.get(field):
|
||||||
|
query = query.where(table[field] == filters.get(field))
|
||||||
|
|
||||||
|
bundle_data = query.run(as_dict=True)
|
||||||
|
|
||||||
if bundle_data:
|
if bundle_data:
|
||||||
opening_data.qty_after_transaction += flt(bundle_data[0].qty)
|
opening_data.qty_after_transaction += flt(bundle_data[0].qty)
|
||||||
opening_data.stock_value += flt(bundle_data[0].stock_value)
|
opening_data.stock_value += flt(bundle_data[0].stock_value)
|
||||||
|
|||||||
Reference in New Issue
Block a user