Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:added filter for stone details. #135

Merged
merged 3 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions aumms/aumms/doc_events/purchase_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@
from frappe import _
from aumms.aumms.utils import *

@frappe.whitelist()
def get_item_details(old_item, item_type, date, purity, stock_uom):
''' Method for fetching qty, making_charge_percentage, making_charge & board_rate '''
item_details = { 'qty':0, 'board_rate':0 }
if old_item:
item_doc = frappe.get_doc('Old Jewellery Item', old_item)
item_details['qty'] = item_doc.weight_per_unit
item_details['board_rate'] = get_board_rate(item_type, purity, stock_uom, date)
return item_details

@frappe.whitelist()
def set_supplier_type (supplier):
''' Method for setting supplier type in purchase order item'''
Expand Down
20 changes: 18 additions & 2 deletions aumms/aumms/doctype/aumms_item/aumms_item.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
// For license information, please see license.txt

frappe.ui.form.on('AuMMS Item', {
setup: function(frm) {
set_filters(frm);
},
onload(frm) {
frm.trigger('is_purity_item');
},
Expand Down Expand Up @@ -79,9 +82,12 @@ frappe.ui.form.on('AuMMS Item', {
},
has_stone(frm){
if(!frm.doc.has_stone){
frm.set_value('stone_weight', 0);
frm.set_value('stone_charge', 0);
frm.clear_table('stone_details');
}
frm.toggle_display('is_stone_item', !frm.doc.has_stone);
},
is_stone_item(frm) {
frm.toggle_display('has_stone', !frm.doc.is_stone_item);
}
});

Expand Down Expand Up @@ -178,3 +184,13 @@ let trigger_uoms = function () {
}
cur_frm.refresh_field('uoms');
}

let set_filters = function(frm){
frm.set_query('item_name', 'stone_details', () => {
return {
filters: {
is_stone_item: 1,
}
}
});
}
44 changes: 28 additions & 16 deletions aumms/aumms/doctype/aumms_item/aumms_item.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@
"gold_weight",
"weight_per_unit",
"column_break_mjcg9",
"is_stone_item",
"stone_type",
"has_stone",
"stone_weight",
"stone_charge",
"section_break_oeidb",
"stone_details",
"inventory_settings_section",
"is_purchase_item",
"purchase_uom",
Expand Down Expand Up @@ -256,14 +258,6 @@
"fieldtype": "Section Break",
"label": "Weight Details"
},
{
"default": "0",
"depends_on": "has_stone",
"fieldname": "stone_weight",
"fieldtype": "Float",
"label": "Stone Weight",
"mandatory_depends_on": "has_stone"
},
{
"default": "0",
"fieldname": "gold_weight",
Expand All @@ -282,17 +276,35 @@
"label": "Has Stone"
},
{
"default": "0",
"depends_on": "is_stone_item",
"fieldname": "stone_type",
"fieldtype": "Link",
"label": "Stone Type",
"mandatory_depends_on": "is_stone_item",
"options": "Stone Type"
},
{
"depends_on": "has_stone",
"fieldname": "stone_charge",
"fieldtype": "Currency",
"label": "Stone Charge",
"mandatory_depends_on": "has_stone"
"fieldname": "stone_details",
"fieldtype": "Table",
"label": "Stone Details",
"mandatory_depends_on": "has_stone",
"options": "Stone Details"
},
{
"default": "0",
"fieldname": "is_stone_item",
"fieldtype": "Check",
"label": "Is Stone Item"
},
{
"fieldname": "section_break_oeidb",
"fieldtype": "Section Break"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-08-10 13:43:42.899217",
"modified": "2023-08-16 13:06:26.332350",
"modified_by": "Administrator",
"module": "AuMMS",
"name": "AuMMS Item",
Expand Down
2 changes: 1 addition & 1 deletion aumms/aumms/doctype/item_type/item_type.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-01-30 10:41:29.563974",
"modified": "2023-08-11 15:17:37.003816",
"modified_by": "Administrator",
"module": "AuMMS",
"name": "Item Type",
Expand Down
Empty file.
58 changes: 58 additions & 0 deletions aumms/aumms/doctype/stone_details/stone_details.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"actions": [],
"allow_rename": 1,
"creation": "2023-08-14 11:12:10.957799",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"item_name",
"stone_type",
"stone_weight",
"stone_charge"
],
"fields": [
{
"fetch_from": "item_name.stone_type",
"fieldname": "stone_type",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Stone Type",
"reqd": 1
},
{
"fieldname": "stone_weight",
"fieldtype": "Float",
"in_list_view": 1,
"label": "Stone Weight",
"reqd": 1
},
{
"fieldname": "stone_charge",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Stone Charge",
"reqd": 1
},
{
"fetch_from": "aumms_item.item_name",
"fieldname": "item_name",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Item Name",
"options": "AuMMS Item"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-08-16 13:12:43.346842",
"modified_by": "Administrator",
"module": "AuMMS",
"name": "Stone Details",
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",
"sort_order": "DESC",
"states": []
}
8 changes: 8 additions & 0 deletions aumms/aumms/doctype/stone_details/stone_details.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) 2023, efeone and contributors
# For license information, please see license.txt

# import frappe
from frappe.model.document import Document

class StoneDetails(Document):
pass
Empty file.
8 changes: 8 additions & 0 deletions aumms/aumms/doctype/stone_type/stone_type.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright (c) 2023, efeone and contributors
// For license information, please see license.txt

frappe.ui.form.on('Stone Type', {
// refresh: function(frm) {

// }
});
47 changes: 47 additions & 0 deletions aumms/aumms/doctype/stone_type/stone_type.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"actions": [],
"autoname": "field:stone_type",
"creation": "2023-08-11 15:17:46.503565",
"default_view": "List",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"stone_type"
],
"fields": [
{
"fieldname": "stone_type",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Stone Type",
"reqd": 1,
"unique": 1
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-08-14 14:36:16.061421",
"modified_by": "Administrator",
"module": "AuMMS",
"name": "Stone Type",
"naming_rule": "By fieldname",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"sort_field": "modified",
"sort_order": "DESC",
"states": []
}
8 changes: 8 additions & 0 deletions aumms/aumms/doctype/stone_type/stone_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) 2023, efeone and contributors
# For license information, please see license.txt

# import frappe
from frappe.model.document import Document

class StoneType(Document):
pass
9 changes: 9 additions & 0 deletions aumms/aumms/doctype/stone_type/test_stone_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2023, efeone and Contributors
# See license.txt

# import frappe
from frappe.tests.utils import FrappeTestCase


class TestStoneType(FrappeTestCase):
pass
11 changes: 9 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\":\"w1BWPSMDmh\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Item Type\",\"col\":3}},{\"id\":\"u6adwmpaJ0\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Purity\",\"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}}]",
"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\":\"w1BWPSMDmh\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Item Type\",\"col\":3}},{\"id\":\"rlhdXeN4wX\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Stone Type\",\"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\":\"u6adwmpaJ0\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Purity\",\"col\":3}}]",
"creation": "2023-01-06 12:02:34.084523",
"custom_blocks": [],
"docstatus": 0,
Expand All @@ -17,7 +17,7 @@
"is_hidden": 0,
"label": "AuMMS",
"links": [],
"modified": "2023-08-02 10:47:40.529651",
"modified": "2023-08-11 15:50:50.687190",
"modified_by": "Administrator",
"module": "AuMMS",
"name": "AuMMS",
Expand All @@ -36,6 +36,13 @@
"link_to": "Design Request",
"type": "DocType"
},
{
"color": "Grey",
"doc_view": "List",
"label": "Stone Type",
"link_to": "Stone Type",
"type": "DocType"
},
{
"color": "Grey",
"doc_view": "List",
Expand Down
Loading