Skip to content

Commit

Permalink
Merge pull request #36441 from frappe/version-13-hotfix
Browse files Browse the repository at this point in the history
chore: release v13
  • Loading branch information
deepeshgarg007 committed Aug 1, 2023
2 parents 46966f4 + a165b37 commit 348e461
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 9 deletions.
24 changes: 23 additions & 1 deletion erpnext/accounts/doctype/pos_invoice/pos_invoice.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and contributors
# For license information, please see license.txt

import collections

import frappe
from frappe import _
Expand Down Expand Up @@ -44,6 +44,7 @@ def validate(self):
self.validate_debit_to_acc()
self.validate_write_off_account()
self.validate_change_amount()
self.validate_duplicate_serial_and_batch_no()
self.validate_change_account()
self.validate_item_cost_centers()
self.validate_warehouse()
Expand Down Expand Up @@ -154,6 +155,27 @@ def validate_pos_reserved_serial_nos(self, item):
title=_("Item Unavailable"),
)

def validate_duplicate_serial_and_batch_no(self):
serial_nos = []
batch_nos = []

for row in self.get("items"):
if row.serial_no:
serial_nos = row.serial_no.split("\n")

if row.batch_no and not row.serial_no:
batch_nos.append(row.batch_no)

if serial_nos:
for key, value in collections.Counter(serial_nos).items():
if value > 1:
frappe.throw(_("Duplicate Serial No {0} found").format("key"))

if batch_nos:
for key, value in collections.Counter(batch_nos).items():
if value > 1:
frappe.throw(_("Duplicate Batch No {0} found").format("key"))

def validate_pos_reserved_batch_qty(self, item):
filters = {"item_code": item.item_code, "warehouse": item.warehouse, "batch_no": item.batch_no}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def on_submit(self):
else:
frappe.enqueue(
method="erpnext.manufacturing.doctype.bom_update_log.bom_update_log.process_boms_cost_level_wise",
queue="long",
update_doc=self,
now=frappe.flags.in_test,
)
Expand Down
21 changes: 15 additions & 6 deletions erpnext/manufacturing/doctype/bom_update_log/bom_updation_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,21 @@ def _all_children_are_processed(parent_bom):
def get_leaf_boms() -> List[str]:
"Get BOMs that have no dependencies."

return frappe.db.sql_list(
"""select name from `tabBOM` bom
where docstatus=1 and is_active=1
and not exists(select bom_no from `tabBOM Item`
where parent=bom.name and ifnull(bom_no, '')!='')"""
)
bom = frappe.qb.DocType("BOM")
bom_item = frappe.qb.DocType("BOM Item")

boms = (
frappe.qb.from_(bom)
.left_join(bom_item)
.on((bom.name == bom_item.parent) & (bom_item.bom_no != ""))
.select(bom.name)
.where((bom.docstatus == 1) & (bom.is_active == 1) & (bom_item.bom_no.isnull()))
.distinct()
).run(as_list=True)

boms = [bom[0] for bom in boms]

return boms


def _generate_dependence_map() -> defaultdict:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"actions": [],
"autoname": "format:{####}",
"creation": "2019-05-26 15:03:43.996455",
"doctype": "DocType",
Expand All @@ -12,7 +13,6 @@
],
"fields": [
{
"fetch_from": "goal.objective",
"fieldname": "objective",
"fieldtype": "Text",
"in_list_view": 1,
Expand All @@ -38,14 +38,17 @@
}
],
"istable": 1,
"modified": "2019-05-26 16:12:54.832058",
"links": [],
"modified": "2023-07-28 18:10:23.351246",
"modified_by": "Administrator",
"module": "Quality Management",
"name": "Quality Goal Objective",
"naming_rule": "Expression",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"track_changes": 1
}
2 changes: 2 additions & 0 deletions erpnext/stock/stock_ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ def update_args_in_repost_item_valuation(
frappe.publish_realtime(
"item_reposting_progress",
{"name": doc.name, "items_to_be_repost": json.dumps(args, default=str), "current_index": index},
doctype=doc.doctype,
docname=doc.name,
)


Expand Down

0 comments on commit 348e461

Please sign in to comment.