mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-26 13:25:20 +00:00
feat: change sabb qty automatically incase of internal transfer PR if sabb only has 1 batch (#47256)
* feat: change sabb qty automatically incase of internal transfer PR if sabb only has 1 batch
* fix: prevent creation of SABB on every save
* perf: optimize code
* fix: remove unnecessary conditon
* refactor: change if to elif
* fix: remove dn_item_qty and set to item.qty
* test: added test
(cherry picked from commit 47927b38a9)
This commit is contained in:
@@ -98,7 +98,29 @@ class BuyingController(SubcontractingController):
|
||||
item.from_warehouse,
|
||||
type_of_transaction="Outward",
|
||||
do_not_submit=True,
|
||||
qty=item.qty,
|
||||
)
|
||||
elif (
|
||||
not self.is_new()
|
||||
and item.serial_and_batch_bundle
|
||||
and next(
|
||||
(
|
||||
old_item
|
||||
for old_item in self.get_doc_before_save().items
|
||||
if old_item.name == item.name and old_item.qty != item.qty
|
||||
),
|
||||
None,
|
||||
)
|
||||
and len(
|
||||
sabe := frappe.get_all(
|
||||
"Serial and Batch Entry",
|
||||
filters={"parent": item.serial_and_batch_bundle, "serial_no": ["is", "not set"]},
|
||||
pluck="name",
|
||||
)
|
||||
)
|
||||
== 1
|
||||
):
|
||||
frappe.set_value("Serial and Batch Entry", sabe[0], "qty", item.qty)
|
||||
|
||||
def set_rate_for_standalone_debit_note(self):
|
||||
if self.get("is_return") and self.get("update_stock") and not self.return_against:
|
||||
|
||||
Reference in New Issue
Block a user