Merge pull request #51628 from rohitwaghchaure/fixed-removed-unused-code

chore: removed unused code
This commit is contained in:
rohitwaghchaure
2026-01-09 16:21:53 +05:30
committed by GitHub
9 changed files with 7 additions and 61 deletions

View File

@@ -3,7 +3,7 @@ import json
from collections import defaultdict
import frappe
from frappe.query_builder.functions import CombineDatetime, Sum
from frappe.query_builder.functions import Sum
from frappe.utils import flt, nowtime
from pypika import Order
from pypika.functions import Coalesce

View File

@@ -5,7 +5,7 @@
import frappe
from frappe.model.document import Document
from frappe.query_builder import Case, Order
from frappe.query_builder.functions import Coalesce, CombineDatetime, Sum
from frappe.query_builder.functions import Coalesce, Sum
from frappe.utils import flt

View File

@@ -12,7 +12,7 @@ import frappe.query_builder.functions
from frappe import _, _dict, bold
from frappe.model.document import Document
from frappe.model.naming import make_autoname
from frappe.query_builder.functions import CombineDatetime, Sum
from frappe.query_builder.functions import Sum
from frappe.utils import (
cint,
cstr,

View File

@@ -4,7 +4,7 @@
import frappe
from frappe import _, bold, json, msgprint
from frappe.query_builder.functions import CombineDatetime, Sum
from frappe.query_builder.functions import Sum
from frappe.utils import add_to_date, cint, cstr, flt, get_datetime, now
import erpnext

View File

@@ -4,7 +4,6 @@ import datetime
import frappe
from frappe import _, scrub
from frappe.query_builder.functions import CombineDatetime
from frappe.utils import get_datetime, get_first_day_of_week, get_quarter_start, getdate
from frappe.utils import get_first_day as get_first_day_of_month
from frappe.utils.nestedset import get_descendants_of

View File

@@ -7,7 +7,7 @@ from collections import defaultdict
import frappe
from frappe import _
from frappe.query_builder.functions import CombineDatetime, Sum
from frappe.query_builder.functions import Sum
from frappe.utils import cint, flt, get_datetime
from erpnext.stock.doctype.inventory_dimension.inventory_dimension import get_inventory_dimensions

View File

@@ -4,7 +4,7 @@ import frappe
from frappe import _, bold
from frappe.model.naming import NamingSeries, make_autoname, parse_naming_series
from frappe.query_builder import Case
from frappe.query_builder.functions import CombineDatetime, Sum, Timestamp
from frappe.query_builder.functions import Sum, Timestamp
from frappe.utils import add_days, cint, cstr, flt, get_link_to_form, getdate, now, nowtime, today
from pypika import Order
from pypika.terms import ExistsCriterion

View File

@@ -1903,31 +1903,6 @@ def get_sle_by_voucher_detail_no(voucher_detail_no, excluded_sle=None):
)
def get_batch_incoming_rate(item_code, warehouse, batch_no, posting_date, posting_time, creation=None):
sle = frappe.qb.DocType("Stock Ledger Entry")
timestamp_condition = sle.posting_datetime < get_combine_datetime(posting_date, posting_time)
if creation:
timestamp_condition |= (sle.posting_datetime == get_combine_datetime(posting_date, posting_time)) & (
sle.creation < creation
)
batch_details = (
frappe.qb.from_(sle)
.select(Sum(sle.stock_value_difference).as_("batch_value"), Sum(sle.actual_qty).as_("batch_qty"))
.where(
(sle.item_code == item_code)
& (sle.warehouse == warehouse)
& (sle.batch_no == batch_no)
& (sle.is_cancelled == 0)
)
.where(timestamp_condition)
).run(as_dict=True)
if batch_details and batch_details[0].batch_qty:
return batch_details[0].batch_value / batch_details[0].batch_qty
def get_valuation_rate(
item_code,
warehouse,

View File

@@ -6,7 +6,7 @@ import json
import frappe
from frappe import _
from frappe.query_builder.functions import CombineDatetime, IfNull, Sum
from frappe.query_builder.functions import IfNull, Sum
from frappe.utils import cstr, flt, get_link_to_form, get_time, getdate, nowdate, nowtime
import erpnext
@@ -331,34 +331,6 @@ def get_incoming_rate(args, raise_error_if_no_rate=True):
return flt(in_rate)
def get_batch_incoming_rate(item_code, warehouse, batch_no, posting_date, posting_time, creation=None):
sle = frappe.qb.DocType("Stock Ledger Entry")
timestamp_condition = CombineDatetime(sle.posting_date, sle.posting_time) < CombineDatetime(
posting_date, posting_time
)
if creation:
timestamp_condition |= (
CombineDatetime(sle.posting_date, sle.posting_time) == CombineDatetime(posting_date, posting_time)
) & (sle.creation < creation)
batch_details = (
frappe.qb.from_(sle)
.select(Sum(sle.stock_value_difference).as_("batch_value"), Sum(sle.actual_qty).as_("batch_qty"))
.where(
(sle.item_code == item_code)
& (sle.warehouse == warehouse)
& (sle.batch_no == batch_no)
& (sle.serial_and_batch_bundle.isnull())
& (sle.is_cancelled == 0)
)
.where(timestamp_condition)
).run(as_dict=True)
if batch_details and batch_details[0].batch_qty:
return batch_details[0].batch_value / batch_details[0].batch_qty
def get_avg_purchase_rate(serial_nos):
"""get average value of serial numbers"""