Merge pull request #46581 from frappe/version-14-hotfix

chore: release v14
This commit is contained in:
ruthra kumar
2025-03-19 16:33:27 +05:30
committed by GitHub
6 changed files with 71 additions and 33 deletions

View File

@@ -69,6 +69,7 @@ class AssetCapitalization(StockController):
def on_submit(self):
self.update_stock_ledger()
self.make_gl_entries()
self.repost_future_sle_and_gle()
self.update_target_asset()
def on_cancel(self):
@@ -82,6 +83,7 @@ class AssetCapitalization(StockController):
self.cancel_target_asset()
self.update_stock_ledger()
self.make_gl_entries()
self.repost_future_sle_and_gle()
self.restore_consumed_asset_items()
def on_trash(self):

View File

@@ -174,7 +174,7 @@ erpnext.buying.BuyingController = class BuyingController extends erpnext.Transac
}
qty(doc, cdt, cdn) {
if ((doc.doctype == "Purchase Receipt") || (doc.doctype == "Purchase Invoice" && (doc.update_stock || doc.is_return))) {
if ((doc.doctype == "Purchase Receipt") || (doc.doctype == "Purchase Invoice" && doc.update_stock)) {
this.calculate_received_qty(doc, cdt, cdn)
}
super.qty(doc, cdt, cdn);

View File

@@ -190,35 +190,42 @@ class TransactionDeletionRecord(Document):
"""Delete addresses to which leads are linked"""
self.validate_doc_status()
if not self.delete_leads_and_addresses:
leads = frappe.get_all("Lead", filters={"company": self.company})
leads = ["'%s'" % row.get("name") for row in leads]
leads = frappe.db.get_all("Lead", filters={"company": self.company}, pluck="name")
addresses = []
if leads:
addresses = frappe.db.sql_list(
"""select parent from `tabDynamic Link` where link_name
in ({leads})""".format(leads=",".join(leads))
addresses = frappe.db.get_all(
"Dynamic Link", filters={"link_name": ("in", leads)}, pluck="parent"
)
if addresses:
addresses = ["%s" % frappe.db.escape(addr) for addr in addresses]
frappe.db.sql(
"""delete from `tabAddress` where name in ({addresses}) and
name not in (select distinct dl1.parent from `tabDynamic Link` dl1
inner join `tabDynamic Link` dl2 on dl1.parent=dl2.parent
and dl1.link_doctype<>dl2.link_doctype)""".format(addresses=",".join(addresses))
)
address = qb.DocType("Address")
dl1 = qb.DocType("Dynamic Link")
dl2 = qb.DocType("Dynamic Link")
frappe.db.sql(
"""delete from `tabDynamic Link` where link_doctype='Lead'
and parenttype='Address' and link_name in ({leads})""".format(leads=",".join(leads))
)
qb.from_(address).delete().where(
(address.name.isin(addresses))
& (
address.name.notin(
qb.from_(dl1)
.join(dl2)
.on((dl1.parent == dl2.parent) & (dl1.link_doctype != dl2.link_doctype))
.select(dl1.parent)
.distinct()
)
)
).run()
dynamic_link = qb.DocType("Dynamic Link")
qb.from_(dynamic_link).delete().where(
(dynamic_link.link_doctype == "Lead")
& (dynamic_link.parenttype == "Address")
& (dynamic_link.link_name.isin(leads))
).run()
customer = qb.DocType("Customer")
qb.update(customer).set(customer.lead_name, None).where(customer.lead_name.isin(leads)).run()
frappe.db.sql(
"""update `tabCustomer` set lead_name=NULL where lead_name in ({leads})""".format(
leads=",".join(leads)
)
)
self.db_set("delete_leads_and_addresses", 1)
self.enqueue_task(task="Reset Company Values")

View File

@@ -49,6 +49,9 @@ class QualityInspection(Document):
child = self.append("readings", {})
child.update(d)
child.status = "Accepted"
child.parameter_group = frappe.get_value(
"Quality Inspection Parameter", d.specification, "parameter_group"
)
@frappe.whitelist()
def get_quality_inspection_template(self):

View File

@@ -209,7 +209,7 @@ class SerialNo(StockController):
OR serial_no like %s
)
ORDER BY
posting_date desc, posting_time desc, creation desc""",
posting_datetime desc, creation desc""",
(
self.item_code,
self.company,

View File

@@ -1314,17 +1314,38 @@ class StockEntry(StockController):
@frappe.whitelist()
def get_item_details(self, args=None, for_update=False):
item = frappe.db.sql(
"""select i.name, i.stock_uom, i.description, i.image, i.item_name, i.item_group,
i.has_batch_no, i.sample_quantity, i.has_serial_no, i.allow_alternative_item,
id.expense_account, id.buying_cost_center
from `tabItem` i LEFT JOIN `tabItem Default` id ON i.name=id.parent and id.company=%s
where i.name=%s
and i.disabled=0
and (i.end_of_life is null or i.end_of_life<'1900-01-01' or i.end_of_life > %s)""",
(self.company, args.get("item_code"), nowdate()),
as_dict=1,
item = frappe.qb.DocType("Item")
item_default = frappe.qb.DocType("Item Default")
query = (
frappe.qb.from_(item)
.left_join(item_default)
.on((item.name == item_default.parent) & (item_default.company == self.company))
.select(
item.name,
item.stock_uom,
item.description,
item.image,
item.item_name,
item.item_group,
item.has_batch_no,
item.sample_quantity,
item.has_serial_no,
item.allow_alternative_item,
item_default.expense_account,
item_default.buying_cost_center,
)
.where(
(item.name == args.get("item_code"))
& (item.disabled == 0)
& (
(item.end_of_life.isnull())
| (item.end_of_life < "1900-01-01")
| (item.end_of_life > nowdate())
)
)
)
item = query.run(as_dict=True)
if not item:
frappe.throw(
@@ -1369,6 +1390,11 @@ class StockEntry(StockController):
if self.purpose == "Material Issue":
ret["expense_account"] = item.get("expense_account") or item_group_defaults.get("expense_account")
if self.purpose == "Manufacture":
ret["expense_account"] = frappe.get_cached_value(
"Company", self.company, "stock_adjustment_account"
)
for company_field, field in {
"stock_adjustment_account": "expense_account",
"cost_center": "cost_center",