chore: fix conflicts

This commit is contained in:
Rohit Waghchaure
2026-01-09 18:03:28 +05:30
parent 01af6c8762
commit aa43715de6
2 changed files with 15 additions and 36 deletions

View File

@@ -116,15 +116,12 @@ class SerialandBatchBundle(Document):
return return
self.allow_existing_serial_nos() 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 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.validate_serial_nos_duplicate()
self.check_future_entries_exists() self.check_future_entries_exists()
elif ( elif (
self.has_serial_no self.has_serial_no
and self.type_of_transaction == "Outward" and self.type_of_transaction == "Outward"
@@ -132,7 +129,6 @@ class SerialandBatchBundle(Document):
and self.voucher_no and self.voucher_no
): ):
self.validate_serial_no_status() self.validate_serial_no_status()
>>>>>>> 20320c4a6c (perf: SABB taking time to save the record)
self.set_is_outward() self.set_is_outward()
self.calculate_total_qty() self.calculate_total_qty()

View File

@@ -4,13 +4,8 @@ import frappe
from frappe import _, bold from frappe import _, bold
from frappe.model.naming import NamingSeries, make_autoname, parse_naming_series from frappe.model.naming import NamingSeries, make_autoname, parse_naming_series
from frappe.query_builder import Case from frappe.query_builder import Case
<<<<<<< HEAD from frappe.query_builder.functions import CombineDatetime, Max, Sum, Timestamp
from frappe.query_builder.functions import CombineDatetime, Sum, Timestamp
from frappe.utils import add_days, cint, cstr, flt, get_link_to_form, now, nowtime, today 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 import Order
from pypika.terms import ExistsCriterion from pypika.terms import ExistsCriterion
@@ -646,7 +641,7 @@ class SerialNoValuation(DeprecatedSerialNoValuation):
.on(bundle.name == bundle_child.parent) .on(bundle.name == bundle_child.parent)
.select( .select(
bundle_child.serial_no, 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( .where(
(bundle.is_cancelled == 0) (bundle.is_cancelled == 0)
@@ -664,8 +659,13 @@ class SerialNoValuation(DeprecatedSerialNoValuation):
if self.sle.voucher_no: if self.sle.voucher_no:
latest_posting = latest_posting.where(bundle.voucher_no != self.sle.voucher_no) latest_posting = latest_posting.where(bundle.voucher_no != self.sle.voucher_no)
if self.sle.posting_datetime: if self.sle.posting_date:
timestamp_condition = bundle.posting_datetime <= self.sle.posting_datetime 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) latest_posting = latest_posting.where(timestamp_condition)
@@ -682,7 +682,10 @@ class SerialNoValuation(DeprecatedSerialNoValuation):
.join(latest_posting) .join(latest_posting)
.on( .on(
(latest_posting.serial_no == bundle_child.serial_no) (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( .select(
bundle_child.serial_no, bundle_child.serial_no,
@@ -717,31 +720,11 @@ class SerialNoValuation(DeprecatedSerialNoValuation):
bundle_child.serial_no, bundle_child.serial_no,
bundle_child.incoming_rate, 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) 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({}) return frappe._dict(result) if result else frappe._dict({})
>>>>>>> 20320c4a6c (perf: SABB taking time to save the record)
def get_serial_nos(self): def get_serial_nos(self):
if self.sle.get("serial_nos"): if self.sle.get("serial_nos"):