Skip to content

Commit

Permalink
Merge pull request #384 from efeone/aumms_061
Browse files Browse the repository at this point in the history
fix : Updated Aumms Manufacturing Module
  • Loading branch information
muhammadmp authored May 6, 2024
2 parents 9d28eb0 + 29cbd0c commit b35cb83
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 25 deletions.
5 changes: 3 additions & 2 deletions aumms/aumms/doctype/item_category/item_category.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@
"fieldname": "stages",
"fieldtype": "Table",
"label": "Stages",
"options": "Manufacturing Stage Table"
"options": "Manufacturing Stage Table",
"reqd": 1
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2024-04-17 16:00:30.565884",
"modified": "2024-05-06 10:32:54.453320",
"modified_by": "Administrator",
"module": "AuMMS",
"name": "Item Category",
Expand Down
52 changes: 50 additions & 2 deletions aumms/aumms/workspace/aumms/aumms.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"label": "Last Month Board Rate"
}
],
"content": "[{\"id\":\"xytMzcNTlF\",\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\">AuMMS</span>\",\"col\":12}},{\"id\":\"jB5UHMdjpr\",\"type\":\"chart\",\"data\":{\"chart_name\":\"Last Month Board Rate\",\"col\":12}},{\"id\":\"gi-NMLZp61\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Board Rate\",\"col\":3}},{\"id\":\"UlF0vIuW_h\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"AuMMS Item\",\"col\":3}},{\"id\":\"hYF_ghyeVA\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"AuMMS Item Group\",\"col\":3}},{\"id\":\"UWuMllqZ2H\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Purity Conversion Tool\",\"col\":3}},{\"id\":\"aAr2ThZ43S\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Jewellery Invoice\",\"col\":3}},{\"id\":\"RvEzssIYXw\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Design Request\",\"col\":3}},{\"id\":\"wGYHyDla9N\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Design Analysis\",\"col\":3}},{\"id\":\"_LyZYOL-nL\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Bill of Materials\",\"col\":3}},{\"id\":\"5uZY95JpYz\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Work Order\",\"col\":3}},{\"id\":\"HvqBLZ1Lor\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Job Card\",\"col\":3}},{\"id\":\"9w8SYT0U69\",\"type\":\"spacer\",\"data\":{\"col\":12}},{\"id\":\"cT93WyR0mJ\",\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\"><b>Reports &amp; Masters</b></span>\",\"col\":12}},{\"id\":\"HkzazEK-HJ\",\"type\":\"card\",\"data\":{\"card_name\":\"Masters\",\"col\":4}},{\"id\":\"6hfzWxhLly\",\"type\":\"card\",\"data\":{\"card_name\":\"Settings\",\"col\":4}},{\"id\":\"GnDPsk1c5H\",\"type\":\"card\",\"data\":{\"card_name\":\"Reports\",\"col\":4}}]",
"content": "[{\"id\":\"xytMzcNTlF\",\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\">AuMMS</span>\",\"col\":12}},{\"id\":\"jB5UHMdjpr\",\"type\":\"chart\",\"data\":{\"chart_name\":\"Last Month Board Rate\",\"col\":12}},{\"id\":\"gi-NMLZp61\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Board Rate\",\"col\":3}},{\"id\":\"UlF0vIuW_h\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"AuMMS Item\",\"col\":3}},{\"id\":\"hYF_ghyeVA\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"AuMMS Item Group\",\"col\":3}},{\"id\":\"UWuMllqZ2H\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Purity Conversion Tool\",\"col\":3}},{\"id\":\"aAr2ThZ43S\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Jewellery Invoice\",\"col\":3}},{\"id\":\"RvEzssIYXw\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Design Request\",\"col\":3}},{\"id\":\"wGYHyDla9N\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Design Analysis\",\"col\":3}},{\"id\":\"_LyZYOL-nL\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Bill of Materials\",\"col\":3}},{\"id\":\"5uZY95JpYz\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Work Order\",\"col\":3}},{\"id\":\"HvqBLZ1Lor\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Job Card\",\"col\":3}},{\"id\":\"9w8SYT0U69\",\"type\":\"spacer\",\"data\":{\"col\":12}},{\"id\":\"7bvu06zTCN\",\"type\":\"paragraph\",\"data\":{\"text\":\"<span class=\\\"h4\\\"><b>AuMMS Manufacturing</b></span>\",\"col\":12}},{\"id\":\"9t9kxybNJK\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Customer Jewellery Order\",\"col\":3}},{\"id\":\"06TYM1ppyy\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Jewellery Order\",\"col\":3}},{\"id\":\"O0JGHNHtrF\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Manufacturing Request\",\"col\":3}},{\"id\":\"2s8KvBILCm\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Raw Material Request\",\"col\":3}},{\"id\":\"MNE7fNKcwd\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Raw Material Bundle\",\"col\":3}},{\"id\":\"hEIbTGUk-V\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Jewellery Job Card\",\"col\":3}},{\"id\":\"cT93WyR0mJ\",\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\"><b>Reports &amp; Masters</b></span>\",\"col\":12}},{\"id\":\"HkzazEK-HJ\",\"type\":\"card\",\"data\":{\"card_name\":\"Masters\",\"col\":4}},{\"id\":\"6hfzWxhLly\",\"type\":\"card\",\"data\":{\"card_name\":\"Settings\",\"col\":4}},{\"id\":\"GnDPsk1c5H\",\"type\":\"card\",\"data\":{\"card_name\":\"Reports\",\"col\":4}}]",
"creation": "2023-01-06 12:02:34.084523",
"custom_blocks": [],
"docstatus": 0,
Expand Down Expand Up @@ -152,7 +152,7 @@
"type": "Link"
}
],
"modified": "2023-11-17 16:01:17.777066",
"modified": "2024-05-06 10:24:40.490084",
"modified_by": "Administrator",
"module": "AuMMS",
"name": "AuMMS",
Expand All @@ -164,6 +164,54 @@
"roles": [],
"sequence_id": 1.0,
"shortcuts": [
{
"color": "Grey",
"doc_view": "List",
"label": "Raw Material Request",
"link_to": "Raw Material Request",
"stats_filter": "[]",
"type": "DocType"
},
{
"color": "Grey",
"doc_view": "List",
"label": "Manufacturing Request",
"link_to": "Manufacturing Request",
"stats_filter": "[]",
"type": "DocType"
},
{
"color": "Grey",
"doc_view": "List",
"label": "Jewellery Order",
"link_to": "Jewellery Order",
"stats_filter": "[]",
"type": "DocType"
},
{
"color": "Grey",
"doc_view": "List",
"label": "Jewellery Job Card",
"link_to": "Jewellery Job Card",
"stats_filter": "[]",
"type": "DocType"
},
{
"color": "Grey",
"doc_view": "List",
"label": "Raw Material Bundle",
"link_to": "Raw Material Bundle",
"stats_filter": "[]",
"type": "DocType"
},
{
"color": "Grey",
"doc_view": "List",
"label": "Customer Jewellery Order",
"link_to": "Customer Jewellery Order",
"stats_filter": "[]",
"type": "DocType"
},
{
"color": "Grey",
"doc_view": "List",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
frappe.ui.form.on("Customer Jewellery Order", {
refresh: function(frm){
frm.set_query('uom',() => {
frm.set_query('uom','order_items',() => {
return {
filters: {
"is_purity_uom": 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ class JewelleryOrder(Document):
def on_submit(self):
self.create_manufacturing_request()
self.jewellery_order_finished(finished = 1)
self.validate_jewellery_order_items()

def on_cancel(self):
self.jewellery_order_finished(finished = 0)

def on_update(self):
self.out_for_delivery_check()

def before_insert(self):
self.update_jewellery_order_items()

def autoname(self):
if self.order_from == "Customer Jewellery Order":
naming_series ='JO-CJO-' + '.####'
Expand All @@ -23,6 +28,26 @@ def autoname(self):
naming_series ='JO-JSR-' + '.####'
self.name = make_autoname(naming_series)

def update_jewellery_order_items(self):
if self.docstatus == 0:
current_rows = len(self.jewellery_order_items)
required_rows = self.quantity
rows_to_add = required_rows - current_rows
if rows_to_add > 0:
for _ in range(rows_to_add):
self.append('jewellery_order_items', {
'item': '',
'weight': 0
})
elif rows_to_add < 0:
self.jewellery_order_items = self.jewellery_order_items[:required_rows]
if not self.jewellery_order_items:
frappe.throw(_("Jewellery Order Items table is Mandatory."))

def validate_jewellery_order_items(self):
if len(self.jewellery_order_items) == 0:
frappe.throw(_("The Jewellery Order Items table cannot be empty."))

def create_manufacturing_request(self):
"""Create Manufacturing Request For Jewellery Order"""
manufacturing_request_exists = frappe.db.exists('Manufacturing Request', {"jewellery_order": self.name})
Expand Down
4 changes: 1 addition & 3 deletions aumms/fixtures/designation.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
[
{
"appraisal_template": null,
"description": null,
"designation_name": "Smith",
"docstatus": 0,
"doctype": "Designation",
"modified": "2023-11-09 16:31:17.044970",
"name": "Smith",
"skills": []
"name": "Smith"
}
]
21 changes: 21 additions & 0 deletions aumms/fixtures/role.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
[
{
"bulk_actions": 1,
"dashboard": 1,
"desk_access": 1,
"disabled": 0,
"docstatus": 0,
"doctype": "Role",
"form_sidebar": 1,
"home_page": null,
"is_custom": 0,
"list_sidebar": 1,
"modified": "2024-05-03 16:59:21.456754",
"name": "Sales Officer",
"notifications": 1,
"restrict_to_domain": null,
"role_name": "Sales Officer",
"search_bar": 1,
"timeline": 1,
"two_factor_auth": 0,
"view_switcher": 1
},
{
"bulk_actions": 1,
"dashboard": 1,
Expand Down
32 changes: 16 additions & 16 deletions aumms/fixtures/workflow_state.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,37 @@
"docstatus": 0,
"doctype": "Workflow State",
"icon": "",
"modified": "2024-03-19 15:18:22.775660",
"name": "Draft",
"style": "",
"workflow_state_name": "Draft"
"modified": "2024-04-03 16:38:15.882848",
"name": "Cancelled",
"style": "Danger",
"workflow_state_name": "Cancelled"
},
{
"docstatus": 0,
"doctype": "Workflow State",
"icon": "",
"modified": "2024-04-03 16:41:50.343879",
"name": "Submitted for feasibility",
"style": "Info",
"workflow_state_name": "Submitted for feasibility"
"modified": "2024-04-03 16:42:13.775952",
"name": "Not Feasible",
"style": "Danger",
"workflow_state_name": "Not Feasible"
},
{
"docstatus": 0,
"doctype": "Workflow State",
"icon": "",
"modified": "2024-04-03 16:38:15.882848",
"name": "Cancelled",
"style": "Danger",
"workflow_state_name": "Cancelled"
"modified": "2024-03-19 15:18:22.775660",
"name": "Draft",
"style": "",
"workflow_state_name": "Draft"
},
{
"docstatus": 0,
"doctype": "Workflow State",
"icon": "",
"modified": "2024-04-03 16:42:13.775952",
"name": "Not Feasible",
"style": "Danger",
"workflow_state_name": "Not Feasible"
"modified": "2024-04-03 16:41:50.343879",
"name": "Submitted for feasibility",
"style": "Info",
"workflow_state_name": "Submitted for feasibility"
},
{
"docstatus": 0,
Expand Down
2 changes: 1 addition & 1 deletion aumms/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
fixtures = [
{
"dt": "Role",
"filters": [["name", "in", ["Design Analyst", "Supervisor","Smith","Head of Smith", "AuMMS Manager"]]]
"filters": [["name", "in", ["Design Analyst", "Supervisor","Smith","Head of Smith", "AuMMS Manager", "Sales Officer"]]]
},
{
"dt":"Designation",
Expand Down

0 comments on commit b35cb83

Please sign in to comment.