3 Commits

Author SHA1 Message Date
CAnetzberger
f98905f6e6 Small fixes:wq 2023-03-06 16:58:19 +01:00
Christian Anetzberger
e62195815f Update for version-14 2022-11-10 14:49:14 +01:00
Christian Anetzberger
0619cae23c Quick fixes for Version 14 2022-11-09 08:02:29 +01:00
4 changed files with 50 additions and 96 deletions

19
.gitignore vendored
View File

@@ -1,6 +1,19 @@
.DS_Store
*.pyc
*.py~
.DS_Store
conf.py
locale
latest_updates.json
.wnf-lang-status
*.egg-info
*.swp
tags
dist/
manufacturing_overview/public/dist
manufacturing_overview/docs/current
*.swp
*.swo
__pycache__
*~
.idea/
.vscode/
node_modules/
.backportrc.json

View File

@@ -1,13 +1,14 @@
from . import __version__ as app_version
from frappe import _
app_name = "manufacturing_overview"
app_title = "Manufacturing Overview"
app_publisher = "CAnetzberger Design"
app_description = "Dashboard Overview for Sales Orders Items to be manufactured"
app_icon = "octicon octicon-file-directory"
app_icon = "fa fa-th"
app_color = "grey"
app_email = "admin@canetzberger.design"
app_license = "MIT"
required_apps = ["erpnext"]
# Includes in <head>
# ------------------
@@ -148,30 +149,6 @@ app_include_js = "/assets/manufacturing_overview/js/manufacturing_overview.min.j
# auto_cancel_exempted_doctypes = ["Auto Repeat"]
# User Data Protection
# --------------------
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}"
}
]
# Authentication and authorization
# --------------------------------

View File

@@ -6,17 +6,6 @@ from datetime import date
def clearCache(doc, event):
frappe.cache().delete_value("production_overview")
@frappe.whitelist()
def getUserPermissions():
return frappe.get_doc('Production Overview User Mapping', frappe.session.user)
def formatDate(d):
return frappe.utils.formatdate(
d, 'dd.MM.yyyy')
def getDueInDays(d):
delta = d - date.today()
return delta.days
@@ -42,20 +31,6 @@ def shortenCustomerName(customer):
else:
return customer
def calculateSalesOrderStatus(item, warehouseamount, workorders):
if item.delivered_qty < item.qty and item.delivered_qty > 0:
return "Partially Delivered"
elif item.qty <= warehouseamount:
return "In Warehouse"
elif len(workorders) <= 0:
return "No Work Order"
elif len(workorders) > 0 and item.qty > warehouseamount:
return "To Produce"
else:
return "Unknown"
def generateProductionOverviewCache():
salesOrderItems = frappe.db.sql(
"""
@@ -68,6 +43,7 @@ def generateProductionOverviewCache():
`tabSales Order Item`.delivered_qty,
`tabSales Order Item`.delivery_date,
`tabSales Order Item`.item_code,
`tabSales Order Item`.work_order_qty,
`tabSales Order Item`.parent,
`tabSales Order`.status as parentStatus
FROM
@@ -80,7 +56,7 @@ def generateProductionOverviewCache():
status = 'To Deliver and Bill' and
item_group = "Produkte"
ORDER BY
delivery_date
delivery_date, item_code, name
""", as_dict=1)
for soItem in salesOrderItems:
@@ -88,22 +64,26 @@ def generateProductionOverviewCache():
soItem.customer = shortenCustomerName(frappe.get_value(
'Sales Order', soItem.parent, 'customer'))
soItem.wos = frappe.get_all('Work Order', filters=[
['sales_order', '=', soItem.parent], ['production_item', '=', soItem.item_code], ['status', '!=', "Cancelled"]])
# soItem.wos = frappe.get_all('Work Order', filters=[
# ['sales_order', '=', soItem.parent], ['production_item', '=', soItem.item_code], ['status', '!=', "Cancelled"]])
soItem.delivery_date = formatDate(soItem.delivery_date)
soItem.delivery_date = frappe.utils.formatdate(soItem.delivery_date, 'dd.MM.yyyy')
soItem.warehouseamount = getAmountInWarehouses(soItem.item_code)
if soItem.warehouseamount >= soItem.qty:
if soItem.delivered_qty > 0 and soItem.delivered_qty < soItem.qty:
soItem.status = 'Partially Delivered'
elif soItem.delivered_qty >= soItem.qty:
soItem.status = 'Fully Delivered'
elif soItem.warehouseamount >= soItem.qty:
soItem.status = 'In Warehouse'
elif len(soItem.wos) != 0:
elif soItem.work_order_qty > 0:
soItem.status = 'To Produce'
else:
soItem.status = 'No Work Order'
soItem.qty = soItem.qty - soItem.delivered_qty
soItem.link = '/app#Form/Sales%20Order/' + soItem.parent
soItem.link = '/app/sales-order/' + soItem.parent
frappe.cache().set_value("production_overview", salesOrderItems)

View File

@@ -1,34 +1,26 @@
<template>
<a
@click="pushRoute(link)"
class="row link-item text-wrap ellipsis onbpoard-spotlight"
type="Link"
>
<a @click="pushRoute(link)" class="row link-item text-wrap ellipsis onbpoard-spotlight" type="Link">
<div class="col col-xs-8">
<span
class="indicator-pill no-margin"
v-bind:class="{
red: status === 'No Work Order',
blue: status === 'Partially Delivered',
green: status === 'In Warehouse',
yellow: status === 'To Produce',
grey: status === 'Unknown',
}"
></span>
<span class="indicator-pill no-margin" v-bind:class="{
red: status === 'No Work Order',
blue: status === 'Partially Delivered',
gray: status === 'Fully Delivered',
green: status === 'In Warehouse',
yellow: status === 'To Produce',
grey: status === 'Unknown',
}"></span>
<span class="widget-subtitle">{{ qty }}</span> -
<span class="widget-title">{{ item_name }}</span>
<div>
<small v-if="customer && item_code" class="color-secondary"
>{{ customer }} -
<a @click="pushRoute('/app#Form/Item/' + item_code)" type="Link">{{
item_code
}}</a></small
>
<small v-if="customer && item_code" class="color-secondary">{{ customer }} -
<a @click="pushRoute('/app/item/' + item_code)" type="Link">{{
item_code
}}</a></small>
<small v-else-if="customer" class="color-secondary">{{
customer
customer
}}</small>
<small v-else-if="item_code" class="color-secondary">{{
item_code
item_code
}}</small>
</div>
<div>
@@ -36,22 +28,13 @@
</div>
</div>
<div
v-if="due_in < 0"
class="text-muted ellipsis color-secondary col col-xs-4 text-right"
>
<div v-if="due_in < 0" class="text-muted ellipsis color-secondary col col-xs-4 text-right">
<b style="color: red">{{ delivery_date }}</b>
</div>
<div
v-else-if="due_in === 0"
class="text-muted ellipsis color-secondary col col-xs-4 text-right"
>
<div v-else-if="due_in === 0" class="text-muted ellipsis color-secondary col col-xs-4 text-right">
<b style="color: black">{{ delivery_date }}</b>
</div>
<div
v-else
class="text-muted ellipsis color-secondary col col-xs-4 text-right"
>
<div v-else class="text-muted ellipsis color-secondary col col-xs-4 text-right">
{{ delivery_date }}
</div>
</a>
@@ -80,4 +63,5 @@ export default {
</script>
<style>
</style>