Updates to the app, including client scripts and api to get SKU/Warehouse data from the db.

This commit is contained in:
rocketdebris 2025-10-23 10:46:36 -04:00
parent 4212c5e5f5
commit 8e9c2bfb72
11 changed files with 189 additions and 57 deletions

18
uberleben_custom/api.py Normal file
View File

@ -0,0 +1,18 @@
import frappe
import erpnext
@frappe.whitelist()
def get_item_per_wh():
items = frappe.db.get_list("Item", pluck="name")
warehouses = frappe.db.get_list("Warehouse", pluck="name")
data = dict()
for item in items:
data[item] = dict()
for item in items:
for warehouse in warehouses:
data[item][warehouse] = erpnext.stock.utils.get_latest_stock_qty(item, warehouse)
return data

View File

@ -0,0 +1,13 @@
[
{
"docstatus": 0,
"doctype": "Client Script",
"dt": "Item",
"enabled": 1,
"modified": "2025-10-22 10:23:55.971497",
"module": "Uberleben Customizations",
"name": "Update Stock Information",
"script": "frappe.listview_settings[\"Item\"] = frappe.listview_settings[\"Item\"] || {};\n\nfrappe.list_view_settings[\"Item\"].before_render = function() {\n console.log(\"Before Render function.\");\n}",
"view": "List"
}
]

View File

@ -11,15 +11,22 @@ app_license = "mit"
# required_apps = []
# Each item in the list will be shown as an app in the apps page
# add_to_apps_screen = [
# {
# "name": "uberleben_custom",
# "logo": "/assets/uberleben_custom/logo.png",
# "title": "Uberleben Customizations",
# "route": "/uberleben_custom",
# "has_permission": "uberleben_custom.api.permission.has_app_permission"
# }
# ]
add_to_apps_screen = [
{
"name": "uberleben_custom",
"logo": "/assets/uberleben_custom/logo.png",
"title": "Uberleben Customizations",
"route": "/uberleben_custom",
"has_permission": "uberleben_custom.api.permission.has_app_permission"
}
]
# Fixtures
# ------------------
fixtures = [
{"doctype": "Client Script", "filters": [["module", "=", "Uberleben Customizations"]]}
]
# Includes in <head>
# ------------------
@ -61,7 +68,7 @@ app_license = "mit"
# website user home page (by Role)
# role_home_page = {
# "Role": "home_page"
# "Role": "home_page"
# }
# Generators
@ -75,8 +82,8 @@ app_license = "mit"
# add methods and filters to jinja environment
# jinja = {
# "methods": "uberleben_custom.utils.jinja_methods",
# "filters": "uberleben_custom.utils.jinja_filters"
# "methods": "uberleben_custom.utils.jinja_methods",
# "filters": "uberleben_custom.utils.jinja_filters"
# }
# Installation
@ -118,11 +125,11 @@ app_license = "mit"
# Permissions evaluated in scripted ways
# permission_query_conditions = {
# "Event": "frappe.desk.doctype.event.event.get_permission_query_conditions",
# "Event": "frappe.desk.doctype.event.event.get_permission_query_conditions",
# }
#
# has_permission = {
# "Event": "frappe.desk.doctype.event.event.has_permission",
# "Event": "frappe.desk.doctype.event.event.has_permission",
# }
# DocType Class
@ -130,7 +137,7 @@ app_license = "mit"
# Override standard doctype classes
# override_doctype_class = {
# "ToDo": "custom_app.overrides.CustomToDo"
# "ToDo": "custom_app.overrides.CustomToDo"
# }
# Document Events
@ -138,32 +145,32 @@ app_license = "mit"
# Hook on document methods and events
# doc_events = {
# "*": {
# "on_update": "method",
# "on_cancel": "method",
# "on_trash": "method"
# }
# "*": {
# "on_update": "method",
# "on_cancel": "method",
# "on_trash": "method"
# }
# }
# Scheduled Tasks
# ---------------
# scheduler_events = {
# "all": [
# "uberleben_custom.tasks.all"
# ],
# "daily": [
# "uberleben_custom.tasks.daily"
# ],
# "hourly": [
# "uberleben_custom.tasks.hourly"
# ],
# "weekly": [
# "uberleben_custom.tasks.weekly"
# ],
# "monthly": [
# "uberleben_custom.tasks.monthly"
# ],
# "all": [
# "uberleben_custom.tasks.all"
# ],
# "daily": [
# "uberleben_custom.tasks.daily"
# ],
# "hourly": [
# "uberleben_custom.tasks.hourly"
# ],
# "weekly": [
# "uberleben_custom.tasks.weekly"
# ],
# "monthly": [
# "uberleben_custom.tasks.monthly"
# ],
# }
# Testing
@ -175,14 +182,14 @@ app_license = "mit"
# ------------------------------
#
# override_whitelisted_methods = {
# "frappe.desk.doctype.event.event.get_events": "uberleben_custom.event.get_events"
# "frappe.desk.doctype.event.event.get_events": "uberleben_custom.event.get_events"
# }
#
# each overriding function accepts a `data` argument;
# generated from the base implementation of the doctype dashboard,
# along with any modifications made in other Frappe apps
# override_doctype_dashboards = {
# "Task": "uberleben_custom.task.get_dashboard_data"
# "Task": "uberleben_custom.task.get_dashboard_data"
# }
# exempt linked doctypes from being automatically cancelled
@ -208,37 +215,37 @@ app_license = "mit"
# --------------------
# user_data_fields = [
# {
# "doctype": "{doctype_1}",
# "filter_by": "{filter_by}",
# "redact_fields": ["{field_1}", "{field_2}"],
# "partial": 1,
# },
# {
# "doctype": "{doctype_2}",
# "filter_by": "{filter_by}",
# "partial": 1,
# },
# {
# "doctype": "{doctype_3}",
# "strict": False,
# },
# {
# "doctype": "{doctype_4}"
# }
# {
# "doctype": "{doctype_1}",
# "filter_by": "{filter_by}",
# "redact_fields": ["{field_1}", "{field_2}"],
# "partial": 1,
# },
# {
# "doctype": "{doctype_2}",
# "filter_by": "{filter_by}",
# "partial": 1,
# },
# {
# "doctype": "{doctype_3}",
# "strict": False,
# },
# {
# "doctype": "{doctype_4}"
# }
# ]
# Authentication and authorization
# --------------------------------
# auth_hooks = [
# "uberleben_custom.auth.validate"
# "uberleben_custom.auth.validate"
# ]
# Automatically update python controller files with type annotations for this app.
# export_python_type_annotations = True
# default_log_clearing_doctypes = {
# "Logging DocType Name": 30 # days to retain logs
# "Logging DocType Name": 30 # days to retain logs
# }

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

View File

@ -0,0 +1,10 @@
frappe.listview_settings['Item'] = {
add_fields: ['custom_stock_information'],
}
frappe.listview_settings['Item'].formatters = {
custom_stock_information() {
return "none"
}
}

View File

@ -0,0 +1,8 @@
// Copyright (c) 2025, Shiloh Code LLC and contributors
// For license information, please see license.txt
// frappe.ui.form.on("Stock Item Amount", {
// refresh(frm) {
// },
// });

View File

@ -0,0 +1,58 @@
{
"actions": [],
"allow_rename": 1,
"creation": "2025-10-21 22:45:57.569295",
"doctype": "DocType",
"engine": "InnoDB",
"field_order": [
"item",
"warehouse",
"amount"
],
"fields": [
{
"fieldname": "item",
"fieldtype": "Link",
"label": "Item",
"options": "Item"
},
{
"fieldname": "warehouse",
"fieldtype": "Link",
"label": "Warehouse",
"options": "Warehouse"
},
{
"fieldname": "amount",
"fieldtype": "Data",
"label": "Amount"
}
],
"grid_page_length": 50,
"index_web_pages_for_search": 1,
"links": [],
"modified": "2025-10-21 22:46:38.440047",
"modified_by": "Administrator",
"module": "Uberleben Customizations",
"name": "Stock Item Amount",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"row_format": "Dynamic",
"rows_threshold_for_grid_search": 20,
"sort_field": "modified",
"sort_order": "DESC",
"states": []
}

View File

@ -0,0 +1,9 @@
# Copyright (c) 2025, Shiloh Code LLC and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
class StockItemAmount(Document):
pass

View File

@ -0,0 +1,9 @@
# Copyright (c) 2025, Shiloh Code LLC and Contributors
# See license.txt
# import frappe
from frappe.tests.utils import FrappeTestCase
class TestStockItemAmount(FrappeTestCase):
pass