chore: fix conflicts

This commit is contained in:
rohitwaghchaure
2025-10-09 15:26:08 +05:30
committed by Rohit Waghchaure
parent 6ba55bbee0
commit 1fbc03c104
2 changed files with 23 additions and 47 deletions

View File

@@ -2596,51 +2596,6 @@ class TestDeliveryNote(FrappeTestCase):
self.assertEqual(dn.per_billed, 100)
self.assertEqual(dn.per_returned, 100)
<<<<<<< HEAD
=======
def test_packed_item_serial_no_status(self):
from erpnext.selling.doctype.product_bundle.test_product_bundle import make_product_bundle
from erpnext.stock.doctype.item.test_item import make_item
# test Update Items with product bundle
if not frappe.db.exists("Item", "_Test Product Bundle Item New 1"):
bundle_item = make_item("_Test Product Bundle Item New 1", {"is_stock_item": 0})
bundle_item.append(
"item_defaults", {"company": "_Test Company", "default_warehouse": "_Test Warehouse - _TC"}
)
bundle_item.save(ignore_permissions=True)
make_item(
"_Packed Item New Sn Item",
{"is_stock_item": 1, "has_serial_no": 1, "serial_no_series": "SN-PACKED-NEW-.#####"},
)
make_product_bundle("_Test Product Bundle Item New 1", ["_Packed Item New Sn Item"], 1)
make_stock_entry(item="_Packed Item New Sn Item", target="_Test Warehouse - _TC", qty=5, rate=100)
dn = create_delivery_note(
item_code="_Test Product Bundle Item New 1",
warehouse="_Test Warehouse - _TC",
qty=5,
)
dn.reload()
serial_nos = []
for row in dn.packed_items:
self.assertTrue(row.serial_and_batch_bundle)
doc = frappe.get_doc("Serial and Batch Bundle", row.serial_and_batch_bundle)
for row in doc.entries:
status = frappe.db.get_value("Serial No", row.serial_no, "status")
self.assertEqual(status, "Delivered")
serial_nos.append(row.serial_no)
dn.cancel()
for row in serial_nos:
status = frappe.db.get_value("Serial No", row, "status")
self.assertEqual(status, "Active")
def test_sales_return_for_product_bundle(self):
from erpnext.selling.doctype.product_bundle.test_product_bundle import make_product_bundle
from erpnext.stock.doctype.delivery_note.delivery_note import make_sales_return
@@ -2685,6 +2640,8 @@ class TestDeliveryNote(FrappeTestCase):
qty=5,
)
dn.reload()
serial_batch_map = {}
for row in dn.packed_items:
self.assertTrue(row.serial_and_batch_bundle)
@@ -2762,7 +2719,6 @@ class TestDeliveryNote(FrappeTestCase):
serial_batch_map[row.item_code].batch_no_valuation[entry.batch_no],
)
>>>>>>> 1d57bbca11 (test: test case for sales return for product bundle)
def create_delivery_note(**args):
dn = frappe.new_doc("Delivery Note")

View File

@@ -209,7 +209,20 @@ class SerialBatchBundle:
elif sn_doc.has_batch_no and len(sn_doc.entries) == 1:
values_to_update["batch_no"] = sn_doc.entries[0].batch_no
frappe.db.set_value(self.child_doctype, self.sle.voucher_detail_no, values_to_update)
if self.child_doctype == "Packed Item":
name = frappe.db.get_value(
"Packed Item",
{
"parent_detail_docname": sn_doc.voucher_detail_no,
"item_code": self.sle.item_code,
"serial_and_batch_bundle": ("is", "not set"),
},
"name",
)
frappe.db.set_value(self.child_doctype, name, values_to_update)
else:
frappe.db.set_value(self.child_doctype, self.sle.voucher_detail_no, values_to_update)
@property
def child_doctype(self):
@@ -227,6 +240,13 @@ class SerialBatchBundle:
if self.sle.voucher_type == "Asset Repair":
child_doctype = "Asset Repair Consumed Item"
if self.sle.voucher_type in ["Delivery Note", "Sales Invoice"] and self.sle.voucher_detail_no:
if (
frappe.db.get_value(self.sle.voucher_type + " Item", self.sle.voucher_detail_no, "item_code")
!= self.sle.item_code
):
child_doctype = "Packed Item"
return child_doctype
def is_rejected_entry(self):