fix: timeout error while submitting delivery note
This commit is contained in:
parent
787313b875
commit
2d5ccc07b1
@ -329,9 +329,10 @@ class StockController(AccountsController):
|
||||
"""Create batches if required. Called before submit"""
|
||||
for d in self.items:
|
||||
if d.get(warehouse_field) and not d.batch_no:
|
||||
has_batch_no, create_new_batch = frappe.db.get_value(
|
||||
has_batch_no, create_new_batch = frappe.get_cached_value(
|
||||
"Item", d.item_code, ["has_batch_no", "create_new_batch"]
|
||||
)
|
||||
|
||||
if has_batch_no and create_new_batch:
|
||||
d.batch_no = (
|
||||
frappe.get_doc(
|
||||
@ -414,7 +415,7 @@ class StockController(AccountsController):
|
||||
"voucher_no": self.name,
|
||||
"voucher_detail_no": d.name,
|
||||
"actual_qty": (self.docstatus == 1 and 1 or -1) * flt(d.get("stock_qty")),
|
||||
"stock_uom": frappe.db.get_value(
|
||||
"stock_uom": frappe.get_cached_value(
|
||||
"Item", args.get("item_code") or d.get("item_code"), "stock_uom"
|
||||
),
|
||||
"incoming_rate": 0,
|
||||
@ -609,7 +610,7 @@ class StockController(AccountsController):
|
||||
def validate_customer_provided_item(self):
|
||||
for d in self.get("items"):
|
||||
# Customer Provided parts will have zero valuation rate
|
||||
if frappe.db.get_value("Item", d.item_code, "is_customer_provided_item"):
|
||||
if frappe.get_cached_value("Item", d.item_code, "is_customer_provided_item"):
|
||||
d.allow_zero_valuation_rate = 1
|
||||
|
||||
def set_rate_of_stock_uom(self):
|
||||
@ -722,7 +723,7 @@ class StockController(AccountsController):
|
||||
message += _("Please adjust the qty or edit {0} to proceed.").format(rule_link)
|
||||
return message
|
||||
|
||||
def repost_future_sle_and_gle(self):
|
||||
def repost_future_sle_and_gle(self, force=False):
|
||||
args = frappe._dict(
|
||||
{
|
||||
"posting_date": self.posting_date,
|
||||
@ -733,7 +734,7 @@ class StockController(AccountsController):
|
||||
}
|
||||
)
|
||||
|
||||
if future_sle_exists(args) or repost_required_for_queue(self):
|
||||
if force or future_sle_exists(args) or repost_required_for_queue(self):
|
||||
item_based_reposting = cint(
|
||||
frappe.db.get_single_value("Stock Reposting Settings", "item_based_reposting")
|
||||
)
|
||||
@ -894,9 +895,6 @@ def future_sle_exists(args, sl_entries=None):
|
||||
)
|
||||
|
||||
for d in data:
|
||||
if key not in frappe.local.future_sle:
|
||||
frappe.local.future_sle[key] = frappe._dict({})
|
||||
|
||||
frappe.local.future_sle[key][(d.item_code, d.warehouse)] = d.total_row
|
||||
|
||||
return len(data)
|
||||
@ -919,7 +917,7 @@ def validate_future_sle_not_exists(args, key, sl_entries=None):
|
||||
|
||||
def get_cached_data(args, key):
|
||||
if key not in frappe.local.future_sle:
|
||||
return False
|
||||
frappe.local.future_sle[key] = frappe._dict({})
|
||||
|
||||
if args.get("item_code"):
|
||||
item_key = (args.get("item_code"), args.get("warehouse"))
|
||||
|
@ -118,7 +118,7 @@ class DeliveryNote(SellingController):
|
||||
|
||||
def so_required(self):
|
||||
"""check in manage account if sales order required or not"""
|
||||
if frappe.db.get_value("Selling Settings", None, "so_required") == "Yes":
|
||||
if frappe.db.get_single_value("Selling Settings", "so_required") == "Yes":
|
||||
for d in self.get("items"):
|
||||
if not d.against_sales_order:
|
||||
frappe.throw(_("Sales Order required for Item {0}").format(d.item_code))
|
||||
@ -205,7 +205,7 @@ class DeliveryNote(SellingController):
|
||||
super(DeliveryNote, self).validate_warehouse()
|
||||
|
||||
for d in self.get_item_list():
|
||||
if not d["warehouse"] and frappe.db.get_value("Item", d["item_code"], "is_stock_item") == 1:
|
||||
if not d["warehouse"] and frappe.get_cached_value("Item", d["item_code"], "is_stock_item") == 1:
|
||||
frappe.throw(_("Warehouse required for stock Item {0}").format(d["item_code"]))
|
||||
|
||||
def update_current_stock(self):
|
||||
|
@ -629,7 +629,8 @@
|
||||
"no_copy": 1,
|
||||
"options": "Sales Order",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
"read_only": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "against_sales_invoice",
|
||||
@ -662,7 +663,8 @@
|
||||
"label": "Against Sales Invoice Item",
|
||||
"no_copy": 1,
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
"read_only": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "installed_qty",
|
||||
@ -854,7 +856,7 @@
|
||||
"index_web_pages_for_search": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2023-04-06 09:28:29.182053",
|
||||
"modified": "2023-05-01 21:05:14.175640",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Delivery Note Item",
|
||||
|
@ -1392,7 +1392,7 @@ def regenerate_sle_for_batch_stock_reco(detail):
|
||||
if not frappe.db.exists(
|
||||
"Repost Item Valuation", {"voucher_no": doc.name, "status": "Queued", "docstatus": "1"}
|
||||
):
|
||||
doc.repost_future_sle_and_gle()
|
||||
doc.repost_future_sle_and_gle(force=True)
|
||||
|
||||
|
||||
def get_stock_reco_qty_shift(args):
|
||||
|
Loading…
Reference in New Issue
Block a user