Skip to content

Commit

Permalink
Merge pull request #176 from efeone/dr_status_fixes
Browse files Browse the repository at this point in the history
feat: Status in Design Request and some fixes
  • Loading branch information
muhammadmp authored Nov 8, 2023
2 parents 9eb7903 + e638bad commit d78593a
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 8 deletions.
11 changes: 5 additions & 6 deletions aumms/aumms/doctype/aumms_item/aumms_item.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
"fieldtype": "Link",
"ignore_user_permissions": 1,
"label": "Weight UOM",
"mandatory_depends_on": "!has_stone",
"mandatory_depends_on": "(eval:doc.has_stone == 0)||(eval:doc.is_stone_item == 0)",
"options": "UOM"
},
{
Expand Down Expand Up @@ -271,7 +271,7 @@
"fieldname": "gold_weight",
"fieldtype": "Float",
"label": "Gold Weight",
"mandatory_depends_on": "!has_stone",
"mandatory_depends_on": "(eval:doc.has_stone == 0)||(eval:doc.is_stone == 0)",
"non_negative": 1
},
{
Expand Down Expand Up @@ -316,7 +316,7 @@
"fieldname": "stone_weight",
"fieldtype": "Float",
"label": "Stone Weight",
"mandatory_depends_on": "has_stone",
"mandatory_depends_on": "eval:(doc.has_stone || doc.is_stone_item)",
"read_only_depends_on": "has_stone"
},
{
Expand All @@ -325,8 +325,7 @@
"fieldname": "stone_charge",
"fieldtype": "Currency",
"label": "Stone Charge",
"mandatory_depends_on": "has_stone",
"read_only": 1,
"mandatory_depends_on": "eval:(doc.has_stone || doc.is_stone_item)",
"read_only_depends_on": "has_stone"
},
{
Expand All @@ -348,7 +347,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-11-03 15:10:32.224949",
"modified": "2023-11-07 16:46:28.810697",
"modified_by": "Administrator",
"module": "AuMMS",
"name": "AuMMS Item",
Expand Down
11 changes: 11 additions & 0 deletions aumms/aumms/doctype/aumms_item/aumms_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,28 @@

import frappe
from frappe.model.document import Document
from frappe import _

#Fields used to map AuMMS Item to Item
aumms_item_fields = ['item_code', 'item_name', 'item_type', 'stock_uom', 'disabled', 'is_stock_item', 'making_charge_based_on', 'making_charge_percentage', 'making_charge', 'purity', 'purity_percentage', 'is_purity_item', 'description', 'weight_per_unit', 'weight_uom', 'is_purchase_item', 'purchase_uom', 'is_sales_item', 'sales_uom', 'gold_weight', 'has_stone', 'stone_weight', 'stone_charge']

class AuMMSItem(Document):
def validate(self):
''' Method to validate Item name and Item Code '''
self.validate_stone_weight()
self.validate_stone_charge()
if self.is_new():
self.validate_item_name()
self.validate_item_code()

def validate_stone_weight(self):
if not self.stone_weight and self.is_stone_item:
frappe.throw(_('Please Enter Stone weight'))

def validate_stone_charge(self):
if not self.stone_charge and self.is_stone_item:
frappe.throw(_('Please Enter Stone Charge'))

def after_insert(self):
''' Method to create Item from AuMMS Item '''
create_or_update_item(self)
Expand Down
12 changes: 10 additions & 2 deletions aumms/aumms/doctype/design_request/design_request.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"tab_break_gwdao",
"attachment",
"image",
"amended_from"
"amended_from",
"status"
],
"fields": [
{
Expand Down Expand Up @@ -81,6 +82,7 @@
{
"fieldname": "delivery_date",
"fieldtype": "Date",
"in_list_view": 1,
"label": "Delivery Date",
"reqd": 1
},
Expand Down Expand Up @@ -124,12 +126,18 @@
"fieldname": "expected_weight",
"fieldtype": "Float",
"label": "Expected Weight"
},
{
"fieldname": "status",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Status"
}
],
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2023-10-30 12:09:04.160399",
"modified": "2023-11-07 15:47:10.811032",
"modified_by": "Administrator",
"module": "AuMMS",
"name": "Design Request",
Expand Down
16 changes: 16 additions & 0 deletions aumms/aumms/doctype/design_request/design_request_list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
frappe.listview_settings['Design Request'] = {
add_fields: ["id", "status", "mobile_no", "delivery_date"],
has_indicator_for_draft:1,
get_indicator: function(doc) {
const status_colors = {
"Request For Verification": "grey",
"Request For Approval": "orange",
"Approved": "purple",
"Rejected": "red",
"Hold": "red",
"BOM Created": "green",
"Workorder Created": "blue"
};
return [__(doc.status), status_colors[doc.status], "status,=,"+doc.status];
},
};

0 comments on commit d78593a

Please sign in to comment.