Dict[str, Optional[str]]:
+ return scan_barcode(search_value)
def get_conditions(search_term):
diff --git a/erpnext/setup/doctype/company/company_dashboard.py b/erpnext/setup/doctype/company/company_dashboard.py
index ff1e7f1103b2..2d073c1d77ed 100644
--- a/erpnext/setup/doctype/company/company_dashboard.py
+++ b/erpnext/setup/doctype/company/company_dashboard.py
@@ -14,7 +14,7 @@ def get_data():
"goal_doctype_link": "company",
"goal_field": "base_grand_total",
"date_field": "posting_date",
- "filter_str": "docstatus = 1 and is_opening != 'Yes'",
+ "filters": {"docstatus": 1, "is_opening": ("!=", "Yes")},
"aggregation": "sum",
},
"fieldname": "company",
diff --git a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
index f1f5d96e6289..e2eb2a4bbb27 100644
--- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
+++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
@@ -74,6 +74,7 @@
"against_sales_invoice",
"si_detail",
"dn_detail",
+ "pick_list_item",
"section_break_40",
"batch_no",
"serial_no",
@@ -762,13 +763,22 @@
"fieldtype": "Check",
"label": "Grant Commission",
"read_only": 1
+ },
+ {
+ "fieldname": "pick_list_item",
+ "fieldtype": "Data",
+ "hidden": 1,
+ "label": "Pick List Item",
+ "no_copy": 1,
+ "print_hide": 1,
+ "read_only": 1
}
],
"idx": 1,
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
- "modified": "2022-02-24 14:42:20.211085",
+ "modified": "2022-03-31 18:36:24.671913",
"modified_by": "Administrator",
"module": "Stock",
"name": "Delivery Note Item",
diff --git a/erpnext/stock/doctype/item_barcode/item_barcode.json b/erpnext/stock/doctype/item_barcode/item_barcode.json
index d89ca55a4f3f..eef70c95d05c 100644
--- a/erpnext/stock/doctype/item_barcode/item_barcode.json
+++ b/erpnext/stock/doctype/item_barcode/item_barcode.json
@@ -1,109 +1,42 @@
{
- "allow_copy": 0,
- "allow_events_in_timeline": 0,
- "allow_guest_to_view": 0,
- "allow_import": 0,
- "allow_rename": 0,
- "autoname": "field:barcode",
- "beta": 0,
- "creation": "2017-12-09 18:54:50.562438",
- "custom": 0,
- "docstatus": 0,
- "doctype": "DocType",
- "document_type": "",
- "editable_grid": 1,
- "engine": "InnoDB",
+ "actions": [],
+ "autoname": "hash",
+ "creation": "2022-02-11 11:26:22.155183",
+ "doctype": "DocType",
+ "engine": "InnoDB",
+ "field_order": [
+ "barcode",
+ "barcode_type"
+ ],
"fields": [
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "barcode",
- "fieldtype": "Data",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 1,
- "in_list_view": 1,
- "in_standard_filter": 0,
- "label": "Barcode",
- "length": 0,
- "no_copy": 1,
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
+ "fieldname": "barcode",
+ "fieldtype": "Data",
+ "in_global_search": 1,
+ "in_list_view": 1,
+ "label": "Barcode",
+ "no_copy": 1,
"unique": 1
- },
+ },
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "barcode_type",
- "fieldtype": "Select",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 1,
- "in_standard_filter": 0,
- "label": "Barcode Type",
- "length": 0,
- "no_copy": 0,
- "options": "\nEAN\nUPC-A",
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
+ "fieldname": "barcode_type",
+ "fieldtype": "Select",
+ "in_list_view": 1,
+ "label": "Barcode Type",
+ "options": "\nEAN\nUPC-A"
}
- ],
- "has_web_view": 0,
- "hide_heading": 0,
- "hide_toolbar": 0,
- "idx": 0,
- "image_view": 0,
- "in_create": 0,
- "is_submittable": 0,
- "issingle": 0,
- "istable": 1,
- "max_attachments": 0,
- "modified": "2018-11-13 06:03:09.814357",
- "modified_by": "Administrator",
- "module": "Stock",
- "name": "Item Barcode",
- "name_case": "",
- "owner": "Administrator",
- "permissions": [],
- "quick_entry": 1,
- "read_only": 0,
- "read_only_onload": 0,
- "show_name_in_global_search": 0,
- "sort_field": "modified",
- "sort_order": "DESC",
- "track_changes": 1,
- "track_seen": 0,
- "track_views": 0
+ ],
+ "istable": 1,
+ "links": [],
+ "modified": "2022-04-01 05:54:27.314030",
+ "modified_by": "Administrator",
+ "module": "Stock",
+ "name": "Item Barcode",
+ "naming_rule": "Random",
+ "owner": "Administrator",
+ "permissions": [],
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "states": [],
+ "track_changes": 1
}
\ No newline at end of file
diff --git a/erpnext/stock/doctype/pick_list/pick_list.py b/erpnext/stock/doctype/pick_list/pick_list.py
index 7061ee1eea4b..d3476a88f054 100644
--- a/erpnext/stock/doctype/pick_list/pick_list.py
+++ b/erpnext/stock/doctype/pick_list/pick_list.py
@@ -534,6 +534,7 @@ def map_pl_locations(pick_list, item_mapper, delivery_note, sales_order=None):
dn_item = map_child_doc(source_doc, delivery_note, table_mapper)
if dn_item:
+ dn_item.pick_list_item = location.name
dn_item.warehouse = location.warehouse
dn_item.qty = flt(location.picked_qty) / (flt(location.conversion_factor) or 1)
dn_item.batch_no = location.batch_no
diff --git a/erpnext/stock/doctype/pick_list/test_pick_list.py b/erpnext/stock/doctype/pick_list/test_pick_list.py
index 7496b6b1798c..ec5011b93d6f 100644
--- a/erpnext/stock/doctype/pick_list/test_pick_list.py
+++ b/erpnext/stock/doctype/pick_list/test_pick_list.py
@@ -521,6 +521,8 @@ def test_multiple_dn_creation(self):
for dn_item in frappe.get_doc("Delivery Note", dn.name).get("items"):
self.assertEqual(dn_item.item_code, "_Test Item")
self.assertEqual(dn_item.against_sales_order, sales_order_1.name)
+ self.assertEqual(dn_item.pick_list_item, pick_list.locations[dn_item.idx - 1].name)
+
for dn in frappe.get_all(
"Delivery Note",
filters={"pick_list": pick_list.name, "customer": "_Test Customer 1"},
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js
index a94087821a5a..0669f55d4a68 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.js
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.js
@@ -646,21 +646,6 @@ frappe.ui.form.on('Stock Entry Detail', {
frm.events.calculate_basic_amount(frm, item);
},
- barcode: function(doc, cdt, cdn) {
- var d = locals[cdt][cdn];
- if (d.barcode) {
- frappe.call({
- method: "erpnext.stock.get_item_details.get_item_code",
- args: {"barcode": d.barcode },
- callback: function(r) {
- if (!r.exe){
- frappe.model.set_value(cdt, cdn, "item_code", r.message);
- }
- }
- });
- }
- },
-
uom: function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
if(d.uom && d.item_code){
diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js
index 84f65a077e0c..05dd105d99d2 100644
--- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js
+++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js
@@ -55,6 +55,25 @@ frappe.ui.form.on("Stock Reconciliation", {
}
},
+ scan_barcode: function(frm) {
+ const barcode_scanner = new erpnext.utils.BarcodeScanner({frm:frm});
+ barcode_scanner.process_scan();
+ },
+
+ scan_mode: function(frm) {
+ if (frm.doc.scan_mode) {
+ frappe.show_alert({
+ message: __("Scan mode enabled, existing quantity will not be fetched."),
+ indicator: "green"
+ });
+ }
+ },
+
+ set_warehouse: function(frm) {
+ let transaction_controller = new erpnext.TransactionController({frm:frm});
+ transaction_controller.autofill_warehouse(frm.doc.items, "warehouse", frm.doc.set_warehouse);
+ },
+
get_items: function(frm) {
let fields = [
{
@@ -148,35 +167,25 @@ frappe.ui.form.on("Stock Reconciliation", {
batch_no: d.batch_no
},
callback: function(r) {
- frappe.model.set_value(cdt, cdn, "qty", r.message.qty);
+ const row = frappe.model.get_doc(cdt, cdn);
+ if (!frm.doc.scan_mode) {
+ frappe.model.set_value(cdt, cdn, "qty", r.message.qty);
+ }
frappe.model.set_value(cdt, cdn, "valuation_rate", r.message.rate);
frappe.model.set_value(cdt, cdn, "current_qty", r.message.qty);
frappe.model.set_value(cdt, cdn, "current_valuation_rate", r.message.rate);
frappe.model.set_value(cdt, cdn, "current_amount", r.message.rate * r.message.qty);
- frappe.model.set_value(cdt, cdn, "amount", r.message.rate * r.message.qty);
+ frappe.model.set_value(cdt, cdn, "amount", row.qty * row.valuation_rate);
frappe.model.set_value(cdt, cdn, "current_serial_no", r.message.serial_nos);
- if (frm.doc.purpose == "Stock Reconciliation") {
+ if (frm.doc.purpose == "Stock Reconciliation" && !frm.doc.scan_mode) {
frappe.model.set_value(cdt, cdn, "serial_no", r.message.serial_nos);
}
}
});
}
},
- set_item_code: function(doc, cdt, cdn) {
- var d = frappe.model.get_doc(cdt, cdn);
- if (d.barcode) {
- frappe.call({
- method: "erpnext.stock.get_item_details.get_item_code",
- args: {"barcode": d.barcode },
- callback: function(r) {
- if (!r.exe){
- frappe.model.set_value(cdt, cdn, "item_code", r.message);
- }
- }
- });
- }
- },
+
set_amount_quantity: function(doc, cdt, cdn) {
var d = frappe.model.get_doc(cdt, cdn);
if (d.qty & d.valuation_rate) {
@@ -214,13 +223,10 @@ frappe.ui.form.on("Stock Reconciliation", {
});
frappe.ui.form.on("Stock Reconciliation Item", {
- barcode: function(frm, cdt, cdn) {
- frm.events.set_item_code(frm, cdt, cdn);
- },
warehouse: function(frm, cdt, cdn) {
var child = locals[cdt][cdn];
- if (child.batch_no) {
+ if (child.batch_no && !frm.doc.scan_mode) {
frappe.model.set_value(child.cdt, child.cdn, "batch_no", "");
}
@@ -229,7 +235,7 @@ frappe.ui.form.on("Stock Reconciliation Item", {
item_code: function(frm, cdt, cdn) {
var child = locals[cdt][cdn];
- if (child.batch_no) {
+ if (child.batch_no && !frm.doc.scan_mode) {
frappe.model.set_value(cdt, cdn, "batch_no", "");
}
@@ -255,7 +261,14 @@ frappe.ui.form.on("Stock Reconciliation Item", {
const serial_nos = child.serial_no.trim().split('\n');
frappe.model.set_value(cdt, cdn, "qty", serial_nos.length);
}
- }
+ },
+
+ items_add: function(frm, cdt, cdn) {
+ var item = frappe.get_doc(cdt, cdn);
+ if (!item.warehouse && frm.doc.set_warehouse) {
+ frappe.model.set_value(cdt, cdn, "warehouse", frm.doc.set_warehouse);
+ }
+ },
});
diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.json b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.json
index a882a61e5a54..e545b8ea5c3c 100644
--- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.json
+++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.json
@@ -14,6 +14,12 @@
"posting_date",
"posting_time",
"set_posting_time",
+ "section_break_8",
+ "set_warehouse",
+ "section_break_22",
+ "scan_barcode",
+ "column_break_12",
+ "scan_mode",
"sb9",
"items",
"section_break_9",
@@ -139,13 +145,44 @@
{
"fieldname": "dimension_col_break",
"fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "section_break_8",
+ "fieldtype": "Section Break"
+ },
+ {
+ "fieldname": "scan_barcode",
+ "fieldtype": "Data",
+ "label": "Scan Barcode",
+ "options": "Barcode"
+ },
+ {
+ "default": "0",
+ "description": "Disables auto-fetching of existing quantity",
+ "fieldname": "scan_mode",
+ "fieldtype": "Check",
+ "label": "Scan Mode"
+ },
+ {
+ "fieldname": "set_warehouse",
+ "fieldtype": "Link",
+ "label": "Default Warehouse",
+ "options": "Warehouse"
+ },
+ {
+ "fieldname": "section_break_22",
+ "fieldtype": "Section Break"
+ },
+ {
+ "fieldname": "column_break_12",
+ "fieldtype": "Column Break"
}
],
"icon": "fa fa-upload-alt",
"idx": 1,
"is_submittable": 1,
"links": [],
- "modified": "2022-02-06 14:28:19.043905",
+ "modified": "2022-03-27 08:57:47.161959",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Reconciliation",
diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
index 07a8566d4a4d..5d5a27f1eab2 100644
--- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
+++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
@@ -1,6 +1,7 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
+from typing import Optional
import frappe
from frappe import _, msgprint
@@ -706,29 +707,43 @@ def get_itemwise_batch(warehouse, posting_date, company, item_code=None):
@frappe.whitelist()
def get_stock_balance_for(
- item_code, warehouse, posting_date, posting_time, batch_no=None, with_valuation_rate=True
+ item_code: str,
+ warehouse: str,
+ posting_date: str,
+ posting_time: str,
+ batch_no: Optional[str] = None,
+ with_valuation_rate: bool = True,
):
frappe.has_permission("Stock Reconciliation", "write", throw=True)
- item_dict = frappe.db.get_value("Item", item_code, ["has_serial_no", "has_batch_no"], as_dict=1)
+ item_dict = frappe.get_cached_value(
+ "Item", item_code, ["has_serial_no", "has_batch_no"], as_dict=1
+ )
if not item_dict:
# In cases of data upload to Items table
msg = _("Item {} does not exist.").format(item_code)
frappe.throw(msg, title=_("Missing"))
- serial_nos = ""
- with_serial_no = True if item_dict.get("has_serial_no") else False
+ serial_nos = None
+ has_serial_no = bool(item_dict.get("has_serial_no"))
+ has_batch_no = bool(item_dict.get("has_batch_no"))
+
+ if not batch_no and has_batch_no:
+ # Not enough information to fetch data
+ return {"qty": 0, "rate": 0, "serial_nos": None}
+
+ # TODO: fetch only selected batch's values
data = get_stock_balance(
item_code,
warehouse,
posting_date,
posting_time,
with_valuation_rate=with_valuation_rate,
- with_serial_no=with_serial_no,
+ with_serial_no=has_serial_no,
)
- if with_serial_no:
+ if has_serial_no:
qty, rate, serial_nos = data
else:
qty, rate = data
diff --git a/erpnext/stock/doctype/stock_reconciliation_item/stock_reconciliation_item.json b/erpnext/stock/doctype/stock_reconciliation_item/stock_reconciliation_item.json
index 6bbba051f985..79c2fcc252c0 100644
--- a/erpnext/stock/doctype/stock_reconciliation_item/stock_reconciliation_item.json
+++ b/erpnext/stock/doctype/stock_reconciliation_item/stock_reconciliation_item.json
@@ -16,15 +16,15 @@
"amount",
"allow_zero_valuation_rate",
"serial_no_and_batch_section",
- "serial_no",
- "column_break_11",
"batch_no",
+ "column_break_11",
+ "serial_no",
"section_break_3",
"current_qty",
- "current_serial_no",
+ "current_amount",
"column_break_9",
"current_valuation_rate",
- "current_amount",
+ "current_serial_no",
"section_break_14",
"quantity_difference",
"column_break_16",
@@ -181,7 +181,7 @@
],
"istable": 1,
"links": [],
- "modified": "2021-05-21 12:13:33.041266",
+ "modified": "2022-04-02 04:19:40.380587",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Reconciliation Item",
@@ -190,5 +190,6 @@
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
+ "states": [],
"track_changes": 1
}
\ No newline at end of file
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index b75bc7241d44..d3a230e3d894 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -167,6 +167,9 @@ def update_stock(args, out):
reserved_so = get_so_reservation_for_item(args)
out.serial_no = get_serial_no(out, args.serial_no, sales_order=reserved_so)
+ if not out.serial_no:
+ out.pop("serial_no", None)
+
def set_valuation_rate(out, args):
if frappe.db.exists("Product Bundle", args.item_code, cache=True):
diff --git a/erpnext/stock/tests/test_utils.py b/erpnext/stock/tests/test_utils.py
new file mode 100644
index 000000000000..9ee0c9f3b5ab
--- /dev/null
+++ b/erpnext/stock/tests/test_utils.py
@@ -0,0 +1,31 @@
+import frappe
+from frappe.tests.utils import FrappeTestCase
+
+from erpnext.stock.doctype.item.test_item import make_item
+from erpnext.stock.utils import scan_barcode
+
+
+class TestStockUtilities(FrappeTestCase):
+ def test_barcode_scanning(self):
+ simple_item = make_item(properties={"barcodes": [{"barcode": "12399"}]})
+ self.assertEqual(scan_barcode("12399")["item_code"], simple_item.name)
+
+ batch_item = make_item(properties={"has_batch_no": 1, "create_new_batch": 1})
+ batch = frappe.get_doc(doctype="Batch", item=batch_item.name).insert()
+
+ batch_scan = scan_barcode(batch.name)
+ self.assertEqual(batch_scan["item_code"], batch_item.name)
+ self.assertEqual(batch_scan["batch_no"], batch.name)
+ self.assertEqual(batch_scan["has_batch_no"], 1)
+ self.assertEqual(batch_scan["has_serial_no"], 0)
+
+ serial_item = make_item(properties={"has_serial_no": 1})
+ serial = frappe.get_doc(
+ doctype="Serial No", item_code=serial_item.name, serial_no=frappe.generate_hash()
+ ).insert()
+
+ serial_scan = scan_barcode(serial.name)
+ self.assertEqual(serial_scan["item_code"], serial_item.name)
+ self.assertEqual(serial_scan["serial_no"], serial.name)
+ self.assertEqual(serial_scan["has_batch_no"], 0)
+ self.assertEqual(serial_scan["has_serial_no"], 1)
diff --git a/erpnext/stock/utils.py b/erpnext/stock/utils.py
index 4f1891fd750e..d40218e14398 100644
--- a/erpnext/stock/utils.py
+++ b/erpnext/stock/utils.py
@@ -3,6 +3,7 @@
import json
+from typing import Dict, Optional
import frappe
from frappe import _
@@ -548,3 +549,51 @@ def check_pending_reposting(posting_date: str, throw_error: bool = True) -> bool
)
return bool(reposting_pending)
+
+
+@frappe.whitelist()
+def scan_barcode(search_value: str) -> Dict[str, Optional[str]]:
+
+ # search barcode no
+ barcode_data = frappe.db.get_value(
+ "Item Barcode",
+ {"barcode": search_value},
+ ["barcode", "parent as item_code"],
+ as_dict=True,
+ )
+ if barcode_data:
+ return _update_item_info(barcode_data)
+
+ # search serial no
+ serial_no_data = frappe.db.get_value(
+ "Serial No",
+ search_value,
+ ["name as serial_no", "item_code", "batch_no"],
+ as_dict=True,
+ )
+ if serial_no_data:
+ return _update_item_info(serial_no_data)
+
+ # search batch no
+ batch_no_data = frappe.db.get_value(
+ "Batch",
+ search_value,
+ ["name as batch_no", "item as item_code"],
+ as_dict=True,
+ )
+ if batch_no_data:
+ return _update_item_info(batch_no_data)
+
+ return {}
+
+
+def _update_item_info(scan_result: Dict[str, Optional[str]]) -> Dict[str, Optional[str]]:
+ if item_code := scan_result.get("item_code"):
+ if item_info := frappe.get_cached_value(
+ "Item",
+ item_code,
+ ["has_batch_no", "has_serial_no"],
+ as_dict=True,
+ ):
+ scan_result.update(item_info)
+ return scan_result
diff --git a/erpnext/templates/pages/home.py b/erpnext/templates/pages/home.py
index bca3e5605362..47fb89dea317 100644
--- a/erpnext/templates/pages/home.py
+++ b/erpnext/templates/pages/home.py
@@ -8,7 +8,7 @@
def get_context(context):
- homepage = frappe.get_doc("Homepage")
+ homepage = frappe.get_cached_doc("Homepage")
for item in homepage.products:
route = frappe.db.get_value("Website Item", {"item_code": item.item_code}, "route")
@@ -20,10 +20,10 @@ def get_context(context):
context.homepage = homepage
if homepage.hero_section_based_on == "Homepage Section" and homepage.hero_section:
- homepage.hero_section_doc = frappe.get_doc("Homepage Section", homepage.hero_section)
+ homepage.hero_section_doc = frappe.get_cached_doc("Homepage Section", homepage.hero_section)
if homepage.slideshow:
- doc = frappe.get_doc("Website Slideshow", homepage.slideshow)
+ doc = frappe.get_cached_doc("Website Slideshow", homepage.slideshow)
context.slideshow = homepage.slideshow
context.slideshow_header = doc.header
context.slides = doc.slideshow_items
@@ -46,7 +46,7 @@ def get_context(context):
order_by="section_order asc",
)
context.homepage_sections = [
- frappe.get_doc("Homepage Section", name) for name in homepage_sections
+ frappe.get_cached_doc("Homepage Section", name) for name in homepage_sections
]
context.metatags = context.metatags or frappe._dict({})