From aa43715de69a7df75d2e9574f82a4fea31663c6e Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Fri, 9 Jan 2026 18:03:28 +0530 Subject: [PATCH] chore: fix conflicts --- .../serial_and_batch_bundle.py | 8 +--- erpnext/stock/serial_batch_bundle.py | 43 ++++++------------- 2 files changed, 15 insertions(+), 36 deletions(-) diff --git a/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py b/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py index fb8430b7437..ad88b571a91 100644 --- a/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py +++ b/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py @@ -116,15 +116,12 @@ class SerialandBatchBundle(Document): return self.allow_existing_serial_nos() -<<<<<<< HEAD - if not self.flags.ignore_validate_serial_batch or frappe.flags.in_test: - self.validate_serial_nos_duplicate() -======= if self.docstatus == 1: - if not self.flags.ignore_validate_serial_batch or frappe.in_test: + if not self.flags.ignore_validate_serial_batch or frappe.flags.in_test: self.validate_serial_nos_duplicate() self.check_future_entries_exists() + elif ( self.has_serial_no and self.type_of_transaction == "Outward" @@ -132,7 +129,6 @@ class SerialandBatchBundle(Document): and self.voucher_no ): self.validate_serial_no_status() ->>>>>>> 20320c4a6c (perf: SABB taking time to save the record) self.set_is_outward() self.calculate_total_qty() diff --git a/erpnext/stock/serial_batch_bundle.py b/erpnext/stock/serial_batch_bundle.py index e7ad3c5de5b..f2639998d3e 100644 --- a/erpnext/stock/serial_batch_bundle.py +++ b/erpnext/stock/serial_batch_bundle.py @@ -4,13 +4,8 @@ import frappe from frappe import _, bold from frappe.model.naming import NamingSeries, make_autoname, parse_naming_series from frappe.query_builder import Case -<<<<<<< HEAD -from frappe.query_builder.functions import CombineDatetime, Sum, Timestamp +from frappe.query_builder.functions import CombineDatetime, Max, Sum, Timestamp from frappe.utils import add_days, cint, cstr, flt, get_link_to_form, now, nowtime, today -======= -from frappe.query_builder.functions import Max, Sum -from frappe.utils import add_days, cint, cstr, flt, get_link_to_form, getdate, now, nowtime, today ->>>>>>> 20320c4a6c (perf: SABB taking time to save the record) from pypika import Order from pypika.terms import ExistsCriterion @@ -646,7 +641,7 @@ class SerialNoValuation(DeprecatedSerialNoValuation): .on(bundle.name == bundle_child.parent) .select( bundle_child.serial_no, - Max(bundle.posting_datetime).as_("max_posting_dt"), + Max(CombineDatetime(bundle.posting_date, bundle.posting_time)).as_("max_posting_dt"), ) .where( (bundle.is_cancelled == 0) @@ -664,8 +659,13 @@ class SerialNoValuation(DeprecatedSerialNoValuation): if self.sle.voucher_no: latest_posting = latest_posting.where(bundle.voucher_no != self.sle.voucher_no) - if self.sle.posting_datetime: - timestamp_condition = bundle.posting_datetime <= self.sle.posting_datetime + if self.sle.posting_date: + if self.sle.posting_time is None: + self.sle.posting_time = nowtime() + + timestamp_condition = CombineDatetime( + bundle.posting_date, bundle.posting_time + ) <= CombineDatetime(self.sle.posting_date, self.sle.posting_time) latest_posting = latest_posting.where(timestamp_condition) @@ -682,7 +682,10 @@ class SerialNoValuation(DeprecatedSerialNoValuation): .join(latest_posting) .on( (latest_posting.serial_no == bundle_child.serial_no) - & (latest_posting.max_posting_dt == bundle.posting_datetime) + & ( + latest_posting.max_posting_dt + == CombineDatetime(bundle.posting_date, bundle.posting_time) + ) ) .select( bundle_child.serial_no, @@ -717,31 +720,11 @@ class SerialNoValuation(DeprecatedSerialNoValuation): bundle_child.serial_no, bundle_child.incoming_rate, ) -<<<<<<< HEAD - .orderby(Timestamp(bundle.posting_date, bundle.posting_time), order=Order.desc) - .limit(1) -======= ->>>>>>> 20320c4a6c (perf: SABB taking time to save the record) ) result = query.run(as_list=1) -<<<<<<< HEAD - if self.sle.posting_date: - if self.sle.posting_time is None: - self.sle.posting_time = nowtime() - - timestamp_condition = CombineDatetime( - bundle.posting_date, bundle.posting_time - ) <= CombineDatetime(self.sle.posting_date, self.sle.posting_time) - - query = query.where(timestamp_condition) - - incoming_rate = query.run() - return flt(incoming_rate[0][0]) if incoming_rate else None -======= return frappe._dict(result) if result else frappe._dict({}) ->>>>>>> 20320c4a6c (perf: SABB taking time to save the record) def get_serial_nos(self): if self.sle.get("serial_nos"):