Compare commits
3 Commits
version-13
...
f98905f6e6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f98905f6e6 | ||
|
|
e62195815f | ||
|
|
0619cae23c |
19
.gitignore
vendored
19
.gitignore
vendored
@@ -1,6 +1,19 @@
|
|||||||
.DS_Store
|
|
||||||
*.pyc
|
*.pyc
|
||||||
|
*.py~
|
||||||
|
.DS_Store
|
||||||
|
conf.py
|
||||||
|
locale
|
||||||
|
latest_updates.json
|
||||||
|
.wnf-lang-status
|
||||||
*.egg-info
|
*.egg-info
|
||||||
|
dist/
|
||||||
|
manufacturing_overview/public/dist
|
||||||
|
manufacturing_overview/docs/current
|
||||||
*.swp
|
*.swp
|
||||||
tags
|
*.swo
|
||||||
manufacturing_overview/docs/current
|
__pycache__
|
||||||
|
*~
|
||||||
|
.idea/
|
||||||
|
.vscode/
|
||||||
|
node_modules/
|
||||||
|
.backportrc.json
|
||||||
@@ -1,13 +1,14 @@
|
|||||||
from . import __version__ as app_version
|
from frappe import _
|
||||||
|
|
||||||
app_name = "manufacturing_overview"
|
app_name = "manufacturing_overview"
|
||||||
app_title = "Manufacturing Overview"
|
app_title = "Manufacturing Overview"
|
||||||
app_publisher = "CAnetzberger Design"
|
app_publisher = "CAnetzberger Design"
|
||||||
app_description = "Dashboard Overview for Sales Orders Items to be manufactured"
|
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_color = "grey"
|
||||||
app_email = "admin@canetzberger.design"
|
app_email = "admin@canetzberger.design"
|
||||||
app_license = "MIT"
|
app_license = "MIT"
|
||||||
|
required_apps = ["erpnext"]
|
||||||
|
|
||||||
# Includes in <head>
|
# Includes in <head>
|
||||||
# ------------------
|
# ------------------
|
||||||
@@ -148,30 +149,6 @@ app_include_js = "/assets/manufacturing_overview/js/manufacturing_overview.min.j
|
|||||||
# auto_cancel_exempted_doctypes = ["Auto Repeat"]
|
# 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
|
# Authentication and authorization
|
||||||
# --------------------------------
|
# --------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -6,17 +6,6 @@ from datetime import date
|
|||||||
def clearCache(doc, event):
|
def clearCache(doc, event):
|
||||||
frappe.cache().delete_value("production_overview")
|
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):
|
def getDueInDays(d):
|
||||||
delta = d - date.today()
|
delta = d - date.today()
|
||||||
return delta.days
|
return delta.days
|
||||||
@@ -42,20 +31,6 @@ def shortenCustomerName(customer):
|
|||||||
else:
|
else:
|
||||||
return customer
|
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():
|
def generateProductionOverviewCache():
|
||||||
salesOrderItems = frappe.db.sql(
|
salesOrderItems = frappe.db.sql(
|
||||||
"""
|
"""
|
||||||
@@ -68,6 +43,7 @@ def generateProductionOverviewCache():
|
|||||||
`tabSales Order Item`.delivered_qty,
|
`tabSales Order Item`.delivered_qty,
|
||||||
`tabSales Order Item`.delivery_date,
|
`tabSales Order Item`.delivery_date,
|
||||||
`tabSales Order Item`.item_code,
|
`tabSales Order Item`.item_code,
|
||||||
|
`tabSales Order Item`.work_order_qty,
|
||||||
`tabSales Order Item`.parent,
|
`tabSales Order Item`.parent,
|
||||||
`tabSales Order`.status as parentStatus
|
`tabSales Order`.status as parentStatus
|
||||||
FROM
|
FROM
|
||||||
@@ -80,7 +56,7 @@ def generateProductionOverviewCache():
|
|||||||
status = 'To Deliver and Bill' and
|
status = 'To Deliver and Bill' and
|
||||||
item_group = "Produkte"
|
item_group = "Produkte"
|
||||||
ORDER BY
|
ORDER BY
|
||||||
delivery_date
|
delivery_date, item_code, name
|
||||||
""", as_dict=1)
|
""", as_dict=1)
|
||||||
|
|
||||||
for soItem in salesOrderItems:
|
for soItem in salesOrderItems:
|
||||||
@@ -88,22 +64,26 @@ def generateProductionOverviewCache():
|
|||||||
|
|
||||||
soItem.customer = shortenCustomerName(frappe.get_value(
|
soItem.customer = shortenCustomerName(frappe.get_value(
|
||||||
'Sales Order', soItem.parent, 'customer'))
|
'Sales Order', soItem.parent, 'customer'))
|
||||||
soItem.wos = frappe.get_all('Work Order', filters=[
|
# soItem.wos = frappe.get_all('Work Order', filters=[
|
||||||
['sales_order', '=', soItem.parent], ['production_item', '=', soItem.item_code], ['status', '!=', "Cancelled"]])
|
# ['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)
|
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'
|
soItem.status = 'In Warehouse'
|
||||||
elif len(soItem.wos) != 0:
|
elif soItem.work_order_qty > 0:
|
||||||
soItem.status = 'To Produce'
|
soItem.status = 'To Produce'
|
||||||
else:
|
else:
|
||||||
soItem.status = 'No Work Order'
|
soItem.status = 'No Work Order'
|
||||||
|
|
||||||
soItem.qty = soItem.qty - soItem.delivered_qty
|
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)
|
frappe.cache().set_value("production_overview", salesOrderItems)
|
||||||
|
|
||||||
|
|||||||
@@ -1,34 +1,26 @@
|
|||||||
<template>
|
<template>
|
||||||
<a
|
<a @click="pushRoute(link)" class="row link-item text-wrap ellipsis onbpoard-spotlight" type="Link">
|
||||||
@click="pushRoute(link)"
|
|
||||||
class="row link-item text-wrap ellipsis onbpoard-spotlight"
|
|
||||||
type="Link"
|
|
||||||
>
|
|
||||||
<div class="col col-xs-8">
|
<div class="col col-xs-8">
|
||||||
<span
|
<span class="indicator-pill no-margin" v-bind:class="{
|
||||||
class="indicator-pill no-margin"
|
red: status === 'No Work Order',
|
||||||
v-bind:class="{
|
blue: status === 'Partially Delivered',
|
||||||
red: status === 'No Work Order',
|
gray: status === 'Fully Delivered',
|
||||||
blue: status === 'Partially Delivered',
|
green: status === 'In Warehouse',
|
||||||
green: status === 'In Warehouse',
|
yellow: status === 'To Produce',
|
||||||
yellow: status === 'To Produce',
|
grey: status === 'Unknown',
|
||||||
grey: status === 'Unknown',
|
}"></span>
|
||||||
}"
|
|
||||||
></span>
|
|
||||||
<span class="widget-subtitle">{{ qty }}</span> -
|
<span class="widget-subtitle">{{ qty }}</span> -
|
||||||
<span class="widget-title">{{ item_name }}</span>
|
<span class="widget-title">{{ item_name }}</span>
|
||||||
<div>
|
<div>
|
||||||
<small v-if="customer && item_code" class="color-secondary"
|
<small v-if="customer && item_code" class="color-secondary">{{ customer }} -
|
||||||
>{{ customer }} -
|
<a @click="pushRoute('/app/item/' + item_code)" type="Link">{{
|
||||||
<a @click="pushRoute('/app#Form/Item/' + item_code)" type="Link">{{
|
item_code
|
||||||
item_code
|
}}</a></small>
|
||||||
}}</a></small
|
|
||||||
>
|
|
||||||
<small v-else-if="customer" class="color-secondary">{{
|
<small v-else-if="customer" class="color-secondary">{{
|
||||||
customer
|
customer
|
||||||
}}</small>
|
}}</small>
|
||||||
<small v-else-if="item_code" class="color-secondary">{{
|
<small v-else-if="item_code" class="color-secondary">{{
|
||||||
item_code
|
item_code
|
||||||
}}</small>
|
}}</small>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@@ -36,22 +28,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div v-if="due_in < 0" class="text-muted ellipsis color-secondary col col-xs-4 text-right">
|
||||||
v-if="due_in < 0"
|
|
||||||
class="text-muted ellipsis color-secondary col col-xs-4 text-right"
|
|
||||||
>
|
|
||||||
<b style="color: red">{{ delivery_date }}</b>
|
<b style="color: red">{{ delivery_date }}</b>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div v-else-if="due_in === 0" class="text-muted ellipsis color-secondary col col-xs-4 text-right">
|
||||||
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>
|
<b style="color: black">{{ delivery_date }}</b>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div v-else class="text-muted ellipsis color-secondary col col-xs-4 text-right">
|
||||||
v-else
|
|
||||||
class="text-muted ellipsis color-secondary col col-xs-4 text-right"
|
|
||||||
>
|
|
||||||
{{ delivery_date }}
|
{{ delivery_date }}
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
@@ -80,4 +63,5 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
Reference in New Issue
Block a user