mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 11:19:09 +00:00
Merge pull request #50002 from rohitwaghchaure/fixed-posting-date-in-serial-no
fix: posting date in serial no
This commit is contained in:
@@ -4,6 +4,9 @@ import frappe
|
|||||||
def execute():
|
def execute():
|
||||||
# Update the reference_name, reference_doctype fields for Serial No where it is null
|
# Update the reference_name, reference_doctype fields for Serial No where it is null
|
||||||
|
|
||||||
|
if not frappe.db.has_column("Serial and Batch Bundle", "posting_date"):
|
||||||
|
return
|
||||||
|
|
||||||
sabb = frappe.qb.DocType("Serial and Batch Bundle")
|
sabb = frappe.qb.DocType("Serial and Batch Bundle")
|
||||||
sabb_entry = frappe.qb.DocType("Serial and Batch Entry")
|
sabb_entry = frappe.qb.DocType("Serial and Batch Entry")
|
||||||
serial_no = frappe.qb.DocType("Serial No").as_("sn")
|
serial_no = frappe.qb.DocType("Serial No").as_("sn")
|
||||||
@@ -16,7 +19,7 @@ def execute():
|
|||||||
.on(sabb.name == sabb_entry.parent)
|
.on(sabb.name == sabb_entry.parent)
|
||||||
.set(serial_no.reference_name, serial_no.purchase_document_no)
|
.set(serial_no.reference_name, serial_no.purchase_document_no)
|
||||||
.set(serial_no.reference_doctype, sabb.voucher_type)
|
.set(serial_no.reference_doctype, sabb.voucher_type)
|
||||||
.set(serial_no.posting_date, sabb.posting_datetime)
|
.set(serial_no.posting_date, sabb.posting_date)
|
||||||
.where(
|
.where(
|
||||||
(sabb.voucher_no == serial_no.purchase_document_no)
|
(sabb.voucher_no == serial_no.purchase_document_no)
|
||||||
& (sabb.is_cancelled == 0)
|
& (sabb.is_cancelled == 0)
|
||||||
|
|||||||
@@ -1293,6 +1293,12 @@ class SerialBatchCreation:
|
|||||||
if self.get("voucher_type"):
|
if self.get("voucher_type"):
|
||||||
voucher_type = self.get("voucher_type")
|
voucher_type = self.get("voucher_type")
|
||||||
|
|
||||||
|
posting_date = frappe.db.get_value(
|
||||||
|
voucher_type,
|
||||||
|
voucher_no,
|
||||||
|
"posting_date",
|
||||||
|
)
|
||||||
|
|
||||||
for _i in range(abs(cint(self.actual_qty))):
|
for _i in range(abs(cint(self.actual_qty))):
|
||||||
serial_no = make_autoname(self.serial_no_series, "Serial No")
|
serial_no = make_autoname(self.serial_no_series, "Serial No")
|
||||||
sr_nos.append(serial_no)
|
sr_nos.append(serial_no)
|
||||||
@@ -1312,6 +1318,7 @@ class SerialBatchCreation:
|
|||||||
"Active",
|
"Active",
|
||||||
voucher_type,
|
voucher_type,
|
||||||
voucher_no,
|
voucher_no,
|
||||||
|
posting_date,
|
||||||
self.batch_no,
|
self.batch_no,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -1332,6 +1339,7 @@ class SerialBatchCreation:
|
|||||||
"status",
|
"status",
|
||||||
"reference_doctype",
|
"reference_doctype",
|
||||||
"reference_name",
|
"reference_name",
|
||||||
|
"posting_date",
|
||||||
"batch_no",
|
"batch_no",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user