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
|
||||
*.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
|
||||
@@ -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
|
||||
# --------------------------------
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user