From 30cfe82af4548c51cf721f088de55cc82cdffe69 Mon Sep 17 00:00:00 2001 From: Muhammed Sinan K T <91651425+MhmdSinanKT@users.noreply.github.com> Date: Mon, 21 Oct 2024 10:07:29 +0530 Subject: [PATCH 01/15] fix: latest changes from mskt to ajmalroshan --- aumms/aumms/doc_events/item.py | 21 +- .../aumms/doc_events/stock_reconciliation.py | 78 +++ .../aumms/doctype/aumms_item/aumms_item.json | 15 +- aumms/aumms/doctype/aumms_item/aumms_item.py | 277 +++++++---- .../doctype/aumms_item/aumms_item_list.js | 22 + .../item_wise_stone_details/__init__.py | 0 .../item_wise_stone_details.json | 68 +++ .../item_wise_stone_details.py | 9 + .../jewellery_item_receipt.json | 101 ++-- .../jewellery_receipt/jewellery_receipt.js | 457 ++++++++++-------- .../jewellery_receipt/jewellery_receipt.json | 16 +- .../jewellery_receipt/jewellery_receipt.py | 255 +++++----- .../aumms/report/metal_ledger/metal_ledger.py | 278 ++++++++--- aumms/aumms/utils.py | 24 +- aumms/aumms/workspace/aumms/aumms.json | 12 +- aumms/hooks.py | 11 +- 16 files changed, 1088 insertions(+), 556 deletions(-) create mode 100644 aumms/aumms/doc_events/stock_reconciliation.py create mode 100644 aumms/aumms/doctype/aumms_item/aumms_item_list.js create mode 100644 aumms/aumms/doctype/item_wise_stone_details/__init__.py create mode 100644 aumms/aumms/doctype/item_wise_stone_details/item_wise_stone_details.json create mode 100644 aumms/aumms/doctype/item_wise_stone_details/item_wise_stone_details.py diff --git a/aumms/aumms/doc_events/item.py b/aumms/aumms/doc_events/item.py index c82bcadb..4482c3fb 100644 --- a/aumms/aumms/doc_events/item.py +++ b/aumms/aumms/doc_events/item.py @@ -1,15 +1,14 @@ -import os import io import json -import frappe -from frappe import _ +import os from datetime import date -from pyqrcode import create -from base64 import b64encode -from pyqrcode import create as qr_create -from frappe.utils.data import get_url_to_form + +import frappe from aumms.aumms.utils import get_conversion_factor +from frappe import _ from frappe.custom.doctype.custom_field.custom_field import create_custom_fields +from pyqrcode import create + @frappe.whitelist() def validate_item(doc, method): @@ -41,8 +40,12 @@ def uom_is_a_purity_uom(uom): uom: name of uom document output: a message iff uom is not a purity uom """ - if not frappe.db.exists('UOM', {'name': uom, 'is_purity_uom': 1}): - frappe.throw(_('{} is not a purity uom'.format(uom))) + pass + # + # This is kept in pass because the integration of Nos as stock qty is ongoing + # + # if not frappe.db.exists('UOM', {'name': uom, 'is_purity_uom': 1}): + # frappe.throw(_('{} is not a purity uom'.format(uom))) @frappe.whitelist() def get_purity_uom(): diff --git a/aumms/aumms/doc_events/stock_reconciliation.py b/aumms/aumms/doc_events/stock_reconciliation.py new file mode 100644 index 00000000..eafa2870 --- /dev/null +++ b/aumms/aumms/doc_events/stock_reconciliation.py @@ -0,0 +1,78 @@ +import frappe +from frappe import _ + + +def get_balance_qty(aumms_item_doc): + filters = { + "item_type": aumms_item_doc.item_type, + "purity": aumms_item_doc.purity, + "stock_uom": aumms_item_doc.weight_uom, + "is_cancelled": 0, + } + return frappe.db.get_value("Metal Ledger Entry", filters, "balance_qty") or 0 + + +def insert_metal_ledger_entry( + doc, item, aumms_item_doc, balance_qty, is_reversal=False +): + fields = { + "doctype": "Metal Ledger Entry", + "posting_date": doc.posting_date, + "posting_time": doc.posting_time, + "voucher_type": doc.doctype, + "voucher_no": doc.name, + "company": frappe.defaults.get_defaults().company, + "item_code": item.item_code, + "item_name": item.item_name, + "stock_uom": aumms_item_doc.weight_uom, + "purity": aumms_item_doc.purity, + "purity_percentage": aumms_item_doc.purity_percentage, + "board_rate": item.valuation_rate, + "batch_no": item.batch_no, + "item_type": aumms_item_doc.item_type, + "balance_qty": balance_qty + + ( + aumms_item_doc.gold_weight + if not is_reversal + else -aumms_item_doc.gold_weight + ), + "amount": item.amount if not is_reversal else -item.amount, + "incoming_rate" if not is_reversal else "outgoing_rate": item.valuation_rate, + } + + frappe.get_doc(fields).insert(ignore_permissions=1) + + +def process_metal_ledger(doc, is_reversal=False): + if not doc.custom_keep_metal_ledger: + return + + ledger_created = False + for item in doc.items: + aumms_item_doc = frappe.get_doc("AuMMS Item", item.item_code) + balance_qty = get_balance_qty(aumms_item_doc) + + insert_metal_ledger_entry(doc, item, aumms_item_doc, balance_qty, is_reversal) + ledger_created = True + + if ledger_created: + action = _("reversed") if is_reversal else _("created") + frappe.msgprint( + _("Metal Ledger Entry is {0}.").format(action), + indicator="green" if not is_reversal else "red", + alert=1, + ) + + +def create_mle_against_sr(doc, method=None): + """ + Method to create metal ledger entries on submit. + """ + process_metal_ledger(doc) + + +def reverse_mle_against_sr(doc, method=None): + """ + Method to reverse metal ledger entries on cancel. + """ + process_metal_ledger(doc, is_reversal=True) diff --git a/aumms/aumms/doctype/aumms_item/aumms_item.json b/aumms/aumms/doctype/aumms_item/aumms_item.json index 92c6a8ac..6bade1e0 100644 --- a/aumms/aumms/doctype/aumms_item/aumms_item.json +++ b/aumms/aumms/doctype/aumms_item/aumms_item.json @@ -18,6 +18,7 @@ "column_break_36khf", "disabled", "is_stock_item", + "create_opening_stock", "is_stone_item", "is_raw_material", "stone_type", @@ -93,7 +94,8 @@ "fieldname": "item_type", "fieldtype": "Link", "label": "Item Type", - "options": "Item Type" + "options": "Item Type", + "reqd": 1 }, { "default": "0", @@ -132,7 +134,7 @@ }, { "default": "0", - "fetch_from": "item_group.is_purity_item", + "fetch_from": "item_type.is_purity_item", "fieldname": "is_purity_item", "fieldtype": "Check", "hidden": 1, @@ -364,11 +366,18 @@ "fieldname": "is_raw_material", "fieldtype": "Check", "label": "Is Raw Material" + }, + { + "default": "0", + "depends_on": "eval: doc.is_stock_item", + "fieldname": "create_opening_stock", + "fieldtype": "Check", + "label": "Create Opening Stock" } ], "index_web_pages_for_search": 1, "links": [], - "modified": "2024-03-28 09:47:38.898756", + "modified": "2024-09-13 14:44:46.727296", "modified_by": "Administrator", "module": "AuMMS", "name": "AuMMS Item", diff --git a/aumms/aumms/doctype/aumms_item/aumms_item.py b/aumms/aumms/doctype/aumms_item/aumms_item.py index 036ba79b..654fa1c7 100644 --- a/aumms/aumms/doctype/aumms_item/aumms_item.py +++ b/aumms/aumms/doctype/aumms_item/aumms_item.py @@ -1,120 +1,193 @@ # Copyright (c) 2023, efeone and contributors # For license information, please see license.txt +import json + 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'] +# 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): - self.validate_gold_weight() - ''' Method to validate Item name and Item Code ''' - """ + def validate(self): + self.validate_gold_weight() + """ 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() - self.validate_gross_wt_stone_wt_and_charge() + if self.is_new(): + self.validate_item_name() + self.validate_item_code() + self.validate_gross_wt_stone_wt_and_charge() - """def validate_stone_weight(self): + """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 validate_gold_weight(self): - if not self.gold_weight and not self.has_stone: - frappe.throw("Gold Weight is mandatory") - - def after_insert(self): - ''' Method to create Item from AuMMS Item ''' - self.create_or_update_item() - - def on_update(self): - ''' Method to update created Item on changes of AuMMS Item ''' - self.create_or_update_item(self.item) - - def validate_item_name(self): - ''' Method to validate AuMMS Item Name wrt to Item Name ''' - if self.item_name: - if frappe.db.exists('Item', { 'item_name' : self.item_name }): - frappe.throw('Item already exists with Item Name `{0}`.'.format(frappe.bold(self.item_name))) - - def validate_gross_wt_stone_wt_and_charge(self): - ''' Method to validate AuMMS Item calculate missing wrt to Item Name ''' - if self.has_stone and (not self.stone_weight or self.stone_charge): - stone_charge = 0 - stone_weight = 0 - for item in self.stone_details: - stone_charge = + stone_charge + item.stone_charge - stone_weight = + stone_weight + item.stone_weight - self.stone_weight = stone_weight - self.stone_charge = stone_charge - - if not self.weight_per_unit: - if self.has_stone and self.gold_weight and self.stone_weight: - self.weight_per_unit = self.gold_weight + self.stone_weight - elif not self.has_stone and self.gold_weight: - self.weight_per_unit = self.gold_weight - - - def validate_item_code(self): - ''' Method to validate AuMMS Item Code wrt to Item Code ''' - if self.item_code: - if frappe.db.exists('Item', { 'item_code' : self.item_code }): - frappe.throw('Item already exists with Item Code `{0}`.'.format(frappe.bold(self.item_code))) - - def create_or_update_item(self, item=None): - ''' Method to create or update Item from AuMMS Item ''' - item_group = frappe.db.get_value('AuMMS Item Group', self.item_group, 'item_group') - if not item: - #Case of new Item - if not frappe.db.exists('Item', self.name): - #Creating new Item object - item_doc = frappe.new_doc('Item') - else: - #Case of exception - return 0 - else: - #Case of existing Item - if frappe.db.exists("Item", item): - #Creating existing Item object - item_doc = frappe.get_doc('Item', item) - else: - #Case of exception - return 0 - - # Check Item Group existance and set Item Group - if item_group: - item_doc.set('item_group', item_group) - - # Set values to Item from AuMMS Item - for aumms_item_field in aumms_item_fields: - item_doc.set(aumms_item_field, self.get(aumms_item_field)) - - item_doc.is_aumms_item = 1 - item_doc.custom_is_raw_material = self.is_raw_material - - - #Clear and Set UOMs to Item - item_doc.uoms = [] - for uom in self.uoms: - row = item_doc.append('uoms') - row.uom = uom.uom - row.conversion_factor = uom.conversion_factor - - if not item: - # Case of new Item - item_doc.insert(ignore_permissions = True) - # Set Item Group link to AuMMS Item Group - frappe.db.set_value('AuMMS Item', self.name, 'item', item_doc.name) - elif frappe.db.exists("Item", item): - # case of updating existing Item - item_doc.save(ignore_permissions = True) - frappe.db.commit() + + def validate_gold_weight(self): + if not self.gold_weight and not self.is_stone_item: + frappe.throw("Gold Weight is mandatory") + + def after_insert(self): + """Method to create Item from AuMMS Item""" + self.create_or_update_item() + if self.create_opening_stock: + create_opening_stock([self.name]) + + def on_update(self): + """Method to update created Item on changes of AuMMS Item""" + self.create_or_update_item(self.item) + + def validate_item_name(self): + """Method to validate AuMMS Item Name wrt to Item Name""" + if self.item_name: + if frappe.db.exists("Item", {"item_name": self.item_name}): + frappe.throw( + "Item already exists with Item Name `{0}`.".format( + frappe.bold(self.item_name) + ) + ) + + def validate_gross_wt_stone_wt_and_charge(self): + """Method to validate AuMMS Item calculate missing wrt to Item Name""" + if self.has_stone and (not self.stone_weight or self.stone_charge): + stone_charge = 0 + stone_weight = 0 + for item in self.stone_details: + stone_charge = +stone_charge + item.stone_charge + stone_weight = +stone_weight + item.stone_weight + self.stone_weight = stone_weight + self.stone_charge = stone_charge + + if not self.weight_per_unit: + if self.has_stone and self.gold_weight and self.stone_weight: + self.weight_per_unit = self.gold_weight + self.stone_weight + elif not self.has_stone and self.gold_weight: + self.weight_per_unit = self.gold_weight + + def validate_item_code(self): + """Method to validate AuMMS Item Code wrt to Item Code""" + if self.item_code: + if frappe.db.exists("Item", {"item_code": self.item_code}): + frappe.throw( + "Item already exists with Item Code `{0}`.".format( + frappe.bold(self.item_code) + ) + ) + + def create_or_update_item(self, item=None): + """Method to create or update Item from AuMMS Item""" + item_group = frappe.db.get_value( + "AuMMS Item Group", self.item_group, "item_group" + ) + if not item: + # Case of new Item + if not frappe.db.exists("Item", self.name): + # Creating new Item object + item_doc = frappe.new_doc("Item") + else: + # Case of exception + return 0 + else: + # Case of existing Item + if frappe.db.exists("Item", item): + # Creating existing Item object + item_doc = frappe.get_doc("Item", item) + else: + # Case of exception + return 0 + + # Check Item Group existance and set Item Group + if item_group: + item_doc.set("item_group", item_group) + + # Set values to Item from AuMMS Item + for aumms_item_field in aumms_item_fields: + item_doc.set(aumms_item_field, self.get(aumms_item_field)) + + item_doc.is_aumms_item = 1 + item_doc.custom_is_raw_material = self.is_raw_material + + # Clear and Set UOMs to Item + item_doc.uoms = [] + for uom in self.uoms: + row = item_doc.append("uoms") + row.uom = uom.uom + row.conversion_factor = uom.conversion_factor + + if not item: + # Case of new Item + item_doc.insert(ignore_permissions=True) + # Set Item Group link to AuMMS Item Group + frappe.db.set_value("AuMMS Item", self.name, "item", item_doc.name) + elif frappe.db.exists("Item", item): + # case of updating existing Item + item_doc.save(ignore_permissions=True) + frappe.db.commit() + + +@frappe.whitelist() +def create_opening_stock_from_list(item_list_json): + item_list = json.loads(item_list_json) + frappe.enqueue( + create_opening_stock, + queue="default", + timeout=6000, + job_name="Opening Stock Creation", + at_front=True, + item_list=item_list, + ) + return "Opening stock creation has been enqueued." + + +def create_opening_stock(item_list): + for item in item_list: + try: + doc = frappe.new_doc("Stock Reconciliation") + doc.purpose = "Opening Stock" + doc.expense_account = "Temporary Opening - A" + doc.append( + "items", + { + "item_code": item, + "warehouse": "Stores - A", + "qty": 5, + "valuation_rate": 10000000, + }, + ) + doc.insert(ignore_permissions=True) + doc.submit() + + except Exception as e: + frappe.log_error(e) diff --git a/aumms/aumms/doctype/aumms_item/aumms_item_list.js b/aumms/aumms/doctype/aumms_item/aumms_item_list.js new file mode 100644 index 00000000..65f1ff38 --- /dev/null +++ b/aumms/aumms/doctype/aumms_item/aumms_item_list.js @@ -0,0 +1,22 @@ +frappe.listview_settings["AuMMS Item"] = { + refresh: function (listview) { + listview.page.add_actions_menu_item( + __("Create Opening Stock"), + function () { + let docnames = listview.get_checked_items(true); + frappe.call({ + method: + "aumms.aumms.doctype.aumms_item.aumms_item.create_opening_stock_from_list", + args: { + item_list_json: JSON.stringify(docnames), // Convert list to JSON string + }, + callback: function (r) { + if (r.message) { + console.log(r.message); + } + }, + }); + } + ); + }, +}; diff --git a/aumms/aumms/doctype/item_wise_stone_details/__init__.py b/aumms/aumms/doctype/item_wise_stone_details/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/aumms/aumms/doctype/item_wise_stone_details/item_wise_stone_details.json b/aumms/aumms/doctype/item_wise_stone_details/item_wise_stone_details.json new file mode 100644 index 00000000..f26f6885 --- /dev/null +++ b/aumms/aumms/doctype/item_wise_stone_details/item_wise_stone_details.json @@ -0,0 +1,68 @@ +{ + "actions": [], + "allow_rename": 1, + "creation": "2024-08-20 10:05:13.872227", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "reference", + "stone", + "uom", + "stone_weight", + "rate", + "amount" + ], + "fields": [ + { + "fieldname": "reference", + "fieldtype": "Data", + "in_list_view": 1, + "label": "Reference" + }, + { + "fieldname": "stone", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Stone", + "options": "AuMMS Item" + }, + { + "fieldname": "uom", + "fieldtype": "Link", + "in_list_view": 1, + "label": "UOM", + "options": "UOM" + }, + { + "fieldname": "stone_weight", + "fieldtype": "Float", + "in_list_view": 1, + "label": "Stone Weight" + }, + { + "fieldname": "rate", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Rate" + }, + { + "fieldname": "amount", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Amount" + } + ], + "index_web_pages_for_search": 1, + "istable": 1, + "links": [], + "modified": "2024-08-20 10:07:11.991708", + "modified_by": "Administrator", + "module": "AuMMS", + "name": "Item Wise Stone Details", + "owner": "Administrator", + "permissions": [], + "sort_field": "modified", + "sort_order": "DESC", + "states": [] +} \ No newline at end of file diff --git a/aumms/aumms/doctype/item_wise_stone_details/item_wise_stone_details.py b/aumms/aumms/doctype/item_wise_stone_details/item_wise_stone_details.py new file mode 100644 index 00000000..653850f9 --- /dev/null +++ b/aumms/aumms/doctype/item_wise_stone_details/item_wise_stone_details.py @@ -0,0 +1,9 @@ +# Copyright (c) 2024, efeone and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + + +class ItemWiseStoneDetails(Document): + pass diff --git a/aumms/aumms/doctype/jewellery_item_receipt/jewellery_item_receipt.json b/aumms/aumms/doctype/jewellery_item_receipt/jewellery_item_receipt.json index 74b10fcd..a17f8224 100644 --- a/aumms/aumms/doctype/jewellery_item_receipt/jewellery_item_receipt.json +++ b/aumms/aumms/doctype/jewellery_item_receipt/jewellery_item_receipt.json @@ -11,18 +11,10 @@ "item_code", "item_type", "item_group", - "has_stone", - "single_stone", - "multi_stone", - "stone", - "add_multi_stone", - "stones", "gold_weight", "uom", - "unit_stone_charge", - "stone_weight", - "individual_stone_weight", "column_break_juco", + "stone_weight_gold_weight_uom", "net_weight", "stone_charge", "making_chargein_percentage", @@ -30,7 +22,19 @@ "purity", "board_rate", "amount_without_making_charge", - "amount" + "amount", + "hallmarked", + "huid", + "section_break_lkhd", + "has_stone", + "stone", + "stone_weight", + "stone_uom", + "rate", + "add_stone", + "column_break_piui", + "stones", + "individual_stone_weight" ], "fields": [ { @@ -54,10 +58,9 @@ "reqd": 1 }, { - "depends_on": "eval:doc.stone", + "depends_on": "eval:doc.has_stone", "fieldname": "stone_weight", "fieldtype": "Float", - "in_list_view": 1, "label": "Stone Weight", "precision": "2" }, @@ -72,7 +75,7 @@ "fieldtype": "Column Break" }, { - "depends_on": "eval:doc.single_stone == 1", + "depends_on": "eval:doc.has_stone", "fieldname": "stone", "fieldtype": "Link", "label": "Stone", @@ -104,7 +107,7 @@ "default": "0", "fieldname": "has_stone", "fieldtype": "Check", - "label": "has Stone" + "label": "Has Stone" }, { "fieldname": "amount_without_making_charge", @@ -119,12 +122,6 @@ "precision": "1", "reqd": 1 }, - { - "depends_on": "eval:doc.has_stone == 1", - "fieldname": "unit_stone_charge", - "fieldtype": "Int", - "label": "Unit Stone Charge" - }, { "fieldname": "individual_stone_weight", "fieldtype": "Data", @@ -165,19 +162,7 @@ "precision": "2" }, { - "default": "0", - "depends_on": "eval:doc.has_stone && !doc.multi_stone == 1", - "fieldname": "single_stone", - "fieldtype": "Check", - "label": "Single Stone" - }, - { - "depends_on": "eval:doc.has_stone && doc.multi_stone == 1", - "fieldname": "add_multi_stone", - "fieldtype": "Button", - "label": "Add Multi Stone" - }, - { + "default": "Gram", "fieldname": "uom", "fieldtype": "Link", "label": "UOM", @@ -185,23 +170,63 @@ "reqd": 1 }, { - "depends_on": "eval:doc.has_stone && doc.multi_stone == 1", + "depends_on": "eval:doc.has_stone", "fieldname": "stones", "fieldtype": "Data", "label": "Stones" }, + { + "fieldname": "section_break_lkhd", + "fieldtype": "Section Break" + }, + { + "depends_on": "eval:doc.has_stone", + "fieldname": "add_stone", + "fieldtype": "Button", + "label": "Add Stone" + }, + { + "fieldname": "column_break_piui", + "fieldtype": "Column Break" + }, + { + "fieldname": "stone_weight_gold_weight_uom", + "fieldtype": "Float", + "in_list_view": 1, + "label": "Stone Weight (Gold Weight UOM)" + }, + { + "default": "Gram", + "depends_on": "eval: doc.has_stone", + "fieldname": "stone_uom", + "fieldtype": "Link", + "label": "UOM", + "options": "UOM" + }, + { + "depends_on": "eval: doc.has_stone", + "fieldname": "rate", + "fieldtype": "Currency", + "label": "Rate" + }, { "default": "0", - "depends_on": "eval:doc.has_stone && !doc.single_stone == 1", - "fieldname": "multi_stone", + "fieldname": "hallmarked", "fieldtype": "Check", - "label": "Multi Stone" + "label": "Hallmarked" + }, + { + "depends_on": "eval: doc.hallmarked", + "fieldname": "huid", + "fieldtype": "Data", + "label": "HUID", + "mandatory_depends_on": "eval: doc.hallmarked" } ], "index_web_pages_for_search": 1, "istable": 1, "links": [], - "modified": "2024-03-20 11:55:02.622652", + "modified": "2024-08-31 11:10:52.640578", "modified_by": "Administrator", "module": "AuMMS", "name": "Jewellery Item Receipt", diff --git a/aumms/aumms/doctype/jewellery_receipt/jewellery_receipt.js b/aumms/aumms/doctype/jewellery_receipt/jewellery_receipt.js index f4d6dead..c631223f 100644 --- a/aumms/aumms/doctype/jewellery_receipt/jewellery_receipt.js +++ b/aumms/aumms/doctype/jewellery_receipt/jewellery_receipt.js @@ -1,229 +1,292 @@ frappe.ui.form.on("Jewellery Receipt", { setup: function (frm) { - frm.set_query('uom', 'item_details', () => { - return { - filters: { - "is_purity_uom": 1 - } - } - }); + frm.set_query("uom", "item_details", () => { + return { + filters: { + is_purity_uom: 1, + }, + }; + }); }, - refresh:function(frm) { - frm.set_query('stone', 'item_details', () => { + refresh: function (frm) { + frm.set_query("stone", "item_details", () => { return { filters: { - "is_stone_item": 1 - } - } - }) + is_stone_item: 1, + }, + }; + }); + }, + item_category: function (frm) { + frm.events.update_item_details_table(frm); }, - item_category: function(frm) { + item_type: function (frm) { frm.events.update_item_details_table(frm); + item_group_filters(frm); }, - item_type: function(frm) { + item_group: function (frm) { frm.events.update_item_details_table(frm); }, - item_group:function(frm) { + purity: function (frm) { frm.events.update_item_details_table(frm); }, - purity: function(frm) { + board_rate: function (frm) { frm.events.update_item_details_table(frm); }, - board_rate: function(frm) { + supplier: function (frm) { frm.events.update_item_details_table(frm); }, - update_item_details_table: function(frm){ - if(frm.doc.item_details){ - frm.doc.item_details.forEach(function(item){ - frappe.model.set_value(item.doctype, item.name, 'item_category', frm.doc.item_category); - frappe.model.set_value(item.doctype, item.name, 'item_type', frm.doc.item_type); - frappe.model.set_value(item.doctype, item.name, 'item_group', frm.doc.item_group); - frappe.model.set_value(item.doctype, item.name, 'purity', frm.doc.purity); - frappe.model.set_value(item.doctype, item.name, 'board_rate', frm.doc.board_rate); + update_item_details_table: function (frm) { + if (frm.doc.item_details) { + let making_charge = 0; - }); + const updateItems = () => { + frm.doc.item_details.forEach(function (item) { + frappe.model.set_value( + item.doctype, + item.name, + "item_category", + frm.doc.item_category + ); + frappe.model.set_value( + item.doctype, + item.name, + "item_type", + frm.doc.item_type + ); + frappe.model.set_value( + item.doctype, + item.name, + "item_group", + frm.doc.item_group + ); + frappe.model.set_value( + item.doctype, + item.name, + "purity", + frm.doc.purity + ); + frappe.model.set_value( + item.doctype, + item.name, + "board_rate", + frm.doc.board_rate + ); + frappe.model.set_value( + item.doctype, + item.name, + "making_chargein_percentage", + making_charge + ); + }); + frm.refresh_fields(); + }; + + updateItems(); } - frm.refresh_fields(); }, - // has_stone: function (frm) { - // if(!frm.doc.has_stone){ - // frm.set_value('stone', ); - // } - // frm.fields_dict.item_details.grid.toggle_enable('has_stone', frm.doc.has_stone); - // frm.refresh_fields(); - // frm.trigger('update_item_details'); - // }, - // stone: function(frm){ - // frm.trigger('update_item_details'); - // }, - // update_item_details: function(frm){ - // if(frm.doc.item_details){ - // frm.doc.item_details.forEach(function(item){ - // frappe.model.set_value(item.doctype, item.name, 'has_stone', frm.doc.has_stone); - // frappe.model.set_value(item.doctype, item.name, 'stone', frm.doc.stone); - // }); - // } - // frm.refresh_fields(); - // }, - // create_item: function(frm) { - // if (frm.is_new()) { - // create_item_details(frm); - // frm.trigger('update_item_details_table'); - // } - // }, - quantity: function(frm) { - var quantity = frm.doc.quantity; - var cur_items_len = frm.doc.item_details.length; - - if (quantity < cur_items_len) { - frm.doc.item_details.splice(quantity); - } else { - for (var i = cur_items_len; i < quantity; i++) { - let row = frm.add_child('item_details', { - item_category: frm.doc.item_category, - item_type: frm.doc.item_type, - item_group: frm.doc.item_group, - purity: frm.doc.purity, - board_rate: frm.doc.board_rate - }); - } - } + quantity: function (frm) { + var quantity = frm.doc.quantity; + var cur_items_len = frm.doc.item_details.length; - frm.refresh_field('item_details'); + if (quantity < cur_items_len) { + frm.doc.item_details.splice(quantity); + } else { + for (var i = cur_items_len; i < quantity; i++) { + let row = frm.add_child("item_details", { + item_category: frm.doc.item_category, + item_type: frm.doc.item_type, + item_group: frm.doc.item_group, + purity: frm.doc.purity, + board_rate: frm.doc.board_rate, + }); + } } + + frm.refresh_field("item_details"); + }, }); frappe.ui.form.on("Jewellery Item Receipt", { - form_render : function(frm, cdt, cdn) { - let d = locals[cdt][cdn]; - if (d.has_stone) { - let net_weight = d.gold_weight + d.stone_weight; - frappe.model.set_value(cdt, cdn, 'net_weight', net_weight); - } - }, - stone_weight: function(frm, cdt, cdn){ - let d = locals[cdt][cdn]; - if (d.single_stone){ - let net_weight = d.gold_weight + d.stone_weight; - frappe.model.set_value(cdt, cdn, 'net_weight', net_weight); - let stone_charge = d.unit_stone_charge * d.stone_weight; - frappe.model.set_value(cdt, cdn, 'stone_charge', stone_charge); - } - }, - making_charge : function(frm, cdt, cdn){ - if (d.making_charge) { - let amount = d.amount_without_making_charge + d.making_charge - frappe.model.set_value(cdt, cdn, 'amount', amount); - }frm.fields_dict.item_details.grid.toggle_enable('has_stone', frm.doc.has_stone);frm.fields_dict.item_details.grid.toggle_enable('has_stone', frm.doc.has_stone); - }, - gold_weight: function(frm, cdt, cdn) { - let d = locals[cdt][cdn]; - if (! d.has_stone) { - let net_weight = d.gold_weight; - frappe.model.set_value(cdt, cdn, 'net_weight', net_weight); - let amount_without_making_charge = (d.gold_weight * frm.doc.board_rate) - frappe.model.set_value(cdt, cdn, 'amount_without_making_charge', amount_without_making_charge); - } - }, - making_chargein_percentage: function(frm, cdt, cdn) { - let d = locals[cdt][cdn]; - if (d.amount_without_making_charge && d.making_chargein_percentage) { - let making_charge = d.amount_without_making_charge * (d.making_chargein_percentage / 100); - frappe.model.set_value(cdt, cdn, 'making_charge', making_charge); - } - }, - making_charge: function(frm, cdt, cdn) { - let d = locals[cdt][cdn]; - if (d.making_charge) { - let amount = d.amount_without_making_charge + d.making_charge - frappe.model.set_value(cdt, cdn, 'amount', amount); - } - }, - stone_charge : function(frm, cdt, cdn){ - let d = locals[cdt][cdn]; - if (d.has_stone){ - let amount_without_making_charge = (d.gold_weight * frm.doc.board_rate) + d.stone_charge - frappe.model.set_value(cdt, cdn, 'amount_without_making_charge', amount_without_making_charge); - } - }, - add_multi_stone: function(frm, cdt, cdn) { - if (frm.is_new()) { - create_multi_stone(frm, cdt, cdn); - } + form_render: function (frm, cdt, cdn) { + let d = locals[cdt][cdn]; + if (d.has_stone) { + let net_weight = d.gold_weight + d.stone_weight; + frappe.model.set_value(cdt, cdn, "net_weight", net_weight); + } + }, + stone_weight: function (frm, cdt, cdn) { + let d = locals[cdt][cdn]; + if (d.single_stone) { + let net_weight = d.gold_weight + d.stone_weight; + frappe.model.set_value(cdt, cdn, "net_weight", net_weight); + let stone_charge = d.unit_stone_charge * d.stone_weight; + frappe.model.set_value(cdt, cdn, "stone_charge", stone_charge); + } + }, + making_charge: function (frm, cdt, cdn) { + if (d.making_charge) { + let amount = d.amount_without_making_charge + d.making_charge; + frappe.model.set_value(cdt, cdn, "amount", amount); + } + frm.fields_dict.item_details.grid.toggle_enable( + "has_stone", + frm.doc.has_stone + ); + frm.fields_dict.item_details.grid.toggle_enable( + "has_stone", + frm.doc.has_stone + ); + }, + gold_weight: function (frm, cdt, cdn) { + let d = locals[cdt][cdn]; + if (!d.has_stone) { + let net_weight = d.gold_weight; + frappe.model.set_value(cdt, cdn, "net_weight", net_weight); + let amount_without_making_charge = d.gold_weight * frm.doc.board_rate; + frappe.model.set_value( + cdt, + cdn, + "amount_without_making_charge", + amount_without_making_charge + ); } + if (d.amount_without_making_charge && d.making_chargein_percentage) { + let making_charge = + d.amount_without_making_charge * (d.making_chargein_percentage / 100); + frappe.model.set_value(cdt, cdn, "making_charge", making_charge); + } + }, + making_chargein_percentage: function (frm, cdt, cdn) { + let d = locals[cdt][cdn]; + if (d.amount_without_making_charge && d.making_chargein_percentage) { + let making_charge = + d.amount_without_making_charge * (d.making_chargein_percentage / 100); + frappe.model.set_value(cdt, cdn, "making_charge", making_charge); + } + }, + making_charge: function (frm, cdt, cdn) { + let d = locals[cdt][cdn]; + if (d.making_charge) { + let amount = d.amount_without_making_charge + d.making_charge; + frappe.model.set_value(cdt, cdn, "amount", amount); + } + }, + stone_charge: function (frm, cdt, cdn) { + let d = locals[cdt][cdn]; + if (d.has_stone) { + let amount_without_making_charge = + d.gold_weight * frm.doc.board_rate + d.stone_charge; + frappe.model.set_value( + cdt, + cdn, + "amount_without_making_charge", + amount_without_making_charge + ); + } + frm.refresh_field("item_details"); + }, + add_stone: function (frm, cdt, cdn) { + let row = locals[cdt][cdn]; + if (frm.is_new()) { + frm.add_child("item_wise_stone_details", { + reference: row.idx, + stone: row.stone, + uom: row.stone_uom, + stone_weight: row.stone_weight, + rate: row.rate, + amount: row.rate * row.stone_weight, + }); + + if (row.stone_weight_gold_weight_uom) + row.stone_weight_gold_weight_uom += row.stone_weight; + else row.stone_weight_gold_weight_uom = row.stone_weight; + row.net_weight += row.stone_weight; + if (row.stone_charge) row.stone_charge += row.rate * row.stone_weight; + else row.stone_charge = row.rate * row.stone_weight; + } + + row.stone = ""; + row.stone_uom = ""; + row.stone_weight = ""; + row.rate = ""; + + frm.refresh_field("item_wise_stone_details"); + frm.refresh_field("item_details"); + }, }); -let create_multi_stone = function(frm, cdt, cdn) { +let create_multi_stone = function (frm, cdt, cdn) { let d = new frappe.ui.Dialog({ - title: 'Enter Stone Details', + title: "Enter Stone Details", fields: [ { - label: 'UOM', - fieldname: 'uom', - fieldtype: 'Link', - options: 'UOM', - reqd: 1 + label: "UOM", + fieldname: "uom", + fieldtype: "Link", + options: "UOM", + reqd: 1, }, { - label: 'Gold Weight', - fieldname: 'gold_weight', - fieldtype: 'Float', + label: "Gold Weight", + fieldname: "gold_weight", + fieldtype: "Float", reqd: 1, }, { - label: 'Making Charge In Percentage', - fieldname: 'making_charge_in_percentage', - fieldtype: 'Percent', - reqd: 1 + label: "Making Charge In Percentage", + fieldname: "making_charge_in_percentage", + fieldtype: "Percent", + reqd: 1, }, { - label: 'Stone Details', - fieldname: 'stone_details', - fieldtype: 'Table', + label: "Stone Details", + fieldname: "stone_details", + fieldtype: "Table", reqd: 1, annotatable: true, editable: true, fields: [ { - label: 'Stone', - fieldname: 'stone', - fieldtype: 'Link', + label: "Stone", + fieldname: "stone", + fieldtype: "Link", in_list_view: 1, - options: 'AuMMS Item' + options: "AuMMS Item", }, { - label: 'Stone Weight', - fieldname: 'stone_weight', - fieldtype: 'Float', - in_list_view: 1 - } - ] + label: "Stone Weight", + fieldname: "stone_weight", + fieldtype: "Float", + in_list_view: 1, + }, + ], }, { - label: 'Total Stone Weight', - fieldname: 'total_stone_weight', - fieldtype: 'Float', + label: "Total Stone Weight", + fieldname: "total_stone_weight", + fieldtype: "Float", }, { - label: 'Unit of Stone Charge', - fieldname: 'unit_stone_charge', - fieldtype: 'Int', - reqd: 1 + label: "Unit of Stone Charge", + fieldname: "unit_stone_charge", + fieldtype: "Int", + reqd: 1, }, ], - primary_action_label: 'Submit', - primary_action: function(values) { + primary_action_label: "Submit", + primary_action: function (values) { var quantity = frm.doc.quantity; for (var i = 0; i < quantity; i++) { - var child = locals[cdt][cdn] + var child = locals[cdt][cdn]; if (!child) { // If the child at index 'i' doesn't exist, add a new row - child = frm.add_child('item_details', { + child = frm.add_child("item_details", { item_category: frm.doc.item_category, item_type: frm.doc.item_type, item_group: frm.doc.item_group, purity: frm.doc.purity, - board_rate: frm.doc.board_rate + board_rate: frm.doc.board_rate, }); } // Update the corresponding fields for the current child row @@ -253,56 +316,70 @@ let create_multi_stone = function(frm, cdt, cdn) { let stone_charge = values.unit_stone_charge * values.total_stone_weight; child.stone_charge = stone_charge; - let amount_without_making_charge = (values.gold_weight * frm.doc.board_rate) + stone_charge; + let amount_without_making_charge = + values.gold_weight * frm.doc.board_rate + stone_charge; child.amount_without_making_charge = amount_without_making_charge; - let making_charge = amount_without_making_charge * (values.making_charge_in_percentage / 100); + let making_charge = + amount_without_making_charge * + (values.making_charge_in_percentage / 100); child.making_charge = making_charge; let amount = amount_without_making_charge + making_charge; - child.amount = amount; - + child.amount = amount; } - refresh_field('item_details'); + refresh_field("item_details"); d.hide(); - } + }, }); function calculate_total_stone_weight() { let total_weight = 0; - let stone_details = d.get_value('stone_details'); + let stone_details = d.get_value("stone_details"); if (stone_details && stone_details.length > 0) { - stone_details.forEach(function(row) { + stone_details.forEach(function (row) { total_weight += row.stone_weight || 0; }); } - d.set_value('total_stone_weight', total_weight); + d.set_value("total_stone_weight", total_weight); } - document.addEventListener('change', function(event) { + document.addEventListener("change", function (event) { if (event.target.matches('[data-fieldname="stone_weight"]')) { calculate_total_stone_weight(); } }); - if ('stone_details' in d.fields_dict) { - d.fields_dict.stone_details.grid.get_field('stone').get_query = function() { + if ("stone_details" in d.fields_dict) { + d.fields_dict.stone_details.grid.get_field("stone").get_query = + function () { return { - filters: { - "is_stone_item": 1 - } + filters: { + is_stone_item: 1, + }, }; - }; - }; - if ('uom' in d.fields_dict) { - d.fields_dict.uom.get_query = function() { + }; + } + if ("uom" in d.fields_dict) { + d.fields_dict.uom.get_query = function () { return { filters: { - "is_purity_uom": 1 - } - } - } + is_purity_uom: 1, + }, + }; + }; } d.show(); }; + +function item_group_filters(frm) { + frm.set_query("item_group", () => { + return { + filters: { + is_aumms_item_group: 1, + item_type: frm.doc.item_type, + }, + }; + }); +} diff --git a/aumms/aumms/doctype/jewellery_receipt/jewellery_receipt.json b/aumms/aumms/doctype/jewellery_receipt/jewellery_receipt.json index 99fccf26..d019ef00 100644 --- a/aumms/aumms/doctype/jewellery_receipt/jewellery_receipt.json +++ b/aumms/aumms/doctype/jewellery_receipt/jewellery_receipt.json @@ -19,6 +19,7 @@ "quantity", "section_break_vxux", "item_details", + "item_wise_stone_details", "amended_from" ], "fields": [ @@ -66,8 +67,8 @@ "fieldtype": "Float", "in_list_view": 1, "label": "Board Rate", - "precision": "2", - "reqd": 1 + "mandatory_depends_on": "eval: doc.is_fix", + "precision": "2" }, { "default": "Today", @@ -105,7 +106,7 @@ "reqd": 1 }, { - "default": "0", + "default": "1", "fieldname": "is_fix", "fieldtype": "Check", "label": "Fixed Charge" @@ -114,12 +115,19 @@ "fieldname": "quantity", "fieldtype": "Int", "label": "Quantity" + }, + { + "fieldname": "item_wise_stone_details", + "fieldtype": "Table", + "label": "Item Wise Stone Details", + "options": "Item Wise Stone Details", + "read_only": 1 } ], "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], - "modified": "2024-03-19 12:52:08.855007", + "modified": "2024-08-20 10:13:09.368757", "modified_by": "Administrator", "module": "AuMMS", "name": "Jewellery Receipt", diff --git a/aumms/aumms/doctype/jewellery_receipt/jewellery_receipt.py b/aumms/aumms/doctype/jewellery_receipt/jewellery_receipt.py index f03b84f0..3b28f432 100644 --- a/aumms/aumms/doctype/jewellery_receipt/jewellery_receipt.py +++ b/aumms/aumms/doctype/jewellery_receipt/jewellery_receipt.py @@ -1,139 +1,130 @@ # Copyright (c) 2024, efeone and contributors # For license information, please see license.txt import frappe -from frappe.model import meta -from frappe.utils import today from frappe.model.document import Document -from frappe.model.naming import make_autoname -from frappe.model.mapper import get_mapped_doc + class JewelleryReceipt(Document): - def autoname(self): - """ - Set the autoname for the document based on the specified format. - """ - for item_detail in self.get("item_details"): - item_code_parts = [self.item_category, str(item_detail.gold_weight)] - - if item_detail.has_stone: - if item_detail.single_stone: - item_code_parts.extend([item_detail.stone, str(item_detail.stone_weight)]) - elif item_detail.multi_stone: - stones = item_detail.stones.split(',') if item_detail.stones else [] - for stone in stones: - item_code_parts.append(stone) - - item_detail.item_code = ' '.join(item_code_parts) - - def validate(self): - self.validate_date() - - def on_submit(self): - self.create_item() - self.create_purchase_receipt() - self.make_form_read_only(['aumms_item', 'purchase_receipt', 'metal_ledger']) - - def validate_date(self): - self.calculate_item_details() - - def make_form_read_only(self, fields): - for field in fields: - self.set(field, 'read_only', 1) - - - def create_item(self): - for item_detail in self.get("item_details"): - aumms_item = frappe.new_doc('AuMMS Item') - aumms_item.item_code = item_detail.item_code - aumms_item.item_name = item_detail.item_code - aumms_item.purity = self.purity - aumms_item.item_group = self.item_group - aumms_item.item_type = self.item_type - aumms_item.weight_per_unit = item_detail.net_weight - aumms_item.weight_uom = item_detail.uom - aumms_item.has_stone = item_detail.has_stone - aumms_item.gold_weight = item_detail.gold_weight - aumms_item.item_category = item_detail.item_category - - if item_detail.has_stone: - if item_detail.single_stone: - aumms_item.append('stone_details', { - 'stone_weight': item_detail.stone_weight, - 'stone_charge': item_detail.stone_charge, - 'item_name': item_detail.stone, - 'stone_type': item_detail.stone, - }) - else: - stones = item_detail.stones.split(',') if item_detail.stones else [] - individual_stone_weight = item_detail.individual_stone_weight - if individual_stone_weight: - stone_weight = individual_stone_weight.split(',') - for stone, weight in zip(stones, stone_weight): - aumms_item.append('stone_details', { - 'stone_weight': float(weight), - 'stone_charge': item_detail.unit_stone_charge * float(weight), - 'item_name': stone, - 'stone_type': stone, - }) - - aumms_item.insert(ignore_permissions=True) - frappe.msgprint('AuMMS Item Created.', indicator="green", alert=1) - created_item_code = aumms_item.item_code - - - def create_purchase_receipt(self): - # Create a new Purchase Receipt - purchase_receipt = frappe.new_doc('Purchase Receipt') - purchase_receipt.supplier = self.supplier - # purchase_receipt.total_qty = self.quantity - purchase_receipt.keep_metal_ledger = 1 - - for item_detail in self.get("item_details"): - purchase_receipt.append('items', { - 'item_code': item_detail.item_code, - 'item_name': item_detail.item_code, - 'board_rate': self.board_rate, - 'qty': item_detail.gold_weight, - 'uom': item_detail.uom, - 'stock_uom': item_detail.uom, - 'conversion_factor': 1, - 'base_rate': self.board_rate, - 'rate': item_detail.amount / item_detail.gold_weight, - 'custom_making_charge': item_detail.making_charge, - 'custom_stone_weight': item_detail.stone_weight, - 'custom_stone_charge': item_detail.stone_charge, - - }) - purchase_receipt.insert(ignore_permissions=True) - purchase_receipt.submit() - frappe.msgprint('Purchase Receipt created.', indicator="green", alert=1) - - # except frappe.DuplicateEntryError as e: - # # Handle duplicate entry error - # frappe.msgprint(f'Duplicate entry error: {e}', indicator="red", alert=1) - # except Exception as ex: - # # Handle other exceptions - # frappe.msgprint(f'Error: {ex}', indicator="red", alert=1) - - def calculate_item_details(self): - for item_detail in self.get("item_details"): - if item_detail.single_stone: - if item_detail.stone_weight: - item_detail.net_weight = item_detail.gold_weight + item_detail.stone_weight - if item_detail.unit_stone_charge: - item_detail.stone_charge = item_detail.unit_stone_charge * item_detail.stone_weight - else: - item_detail.net_weight = item_detail.gold_weight - if self.board_rate: - if item_detail.has_stone: - item_detail.amount_without_making_charge = (item_detail.gold_weight * self.board_rate) + item_detail.stone_charge - else: - item_detail.amount_without_making_charge = item_detail.gold_weight * self.board_rate - - if item_detail.amount_without_making_charge: - item_detail.making_charge = item_detail.amount_without_making_charge * (item_detail.making_chargein_percentage / 100) - - if item_detail.making_charge: - item_detail.amount = item_detail.amount_without_making_charge + item_detail.making_charge - frappe.db.commit() + def autoname(self): + """ + Set the autoname for the document based on the specified format. + """ + for item_detail in self.get("item_details"): + item_code_parts = [self.item_category, str(item_detail.gold_weight)] + + if item_detail.has_stone: + # if item_detail.single_stone: + # item_code_parts.extend([item_detail.stone, str(item_detail.stone_weight)]) + # elif item_detail.multi_stone: + # stones = item_detail.stones.split(',') if item_detail.stones else [] + # for stone in stones: + # item_code_parts.append(stone) + for stone in self.item_wise_stone_details: + item_code_parts.append(stone.stone) + + item_detail.item_code = ' '.join(item_code_parts) + + def validate(self): + self.validate_date() + + def on_submit(self): + self.create_item() + self.create_purchase_receipt() + self.make_form_read_only(['aumms_item', 'purchase_receipt', 'metal_ledger']) + + def validate_date(self): + self.calculate_item_details() + + def make_form_read_only(self, fields): + for field in fields: + self.set(field, 'read_only', 1) + + + def create_item(self): + for item_detail in self.get("item_details"): + aumms_item = frappe.new_doc('AuMMS Item') + aumms_item.item_code = item_detail.item_code + aumms_item.item_name = item_detail.item_code + aumms_item.purity = self.purity + aumms_item.item_group = self.item_group + aumms_item.item_type = self.item_type + aumms_item.weight_per_unit = item_detail.net_weight + aumms_item.weight_uom = item_detail.uom + aumms_item.has_stone = item_detail.has_stone + aumms_item.gold_weight = item_detail.gold_weight + aumms_item.item_category = item_detail.item_category + aumms_item.is_purchase_item = 1 + + if item_detail.hallmarked: + aumms_item.hallmarked = 1 + aumms_item.huid = item_detail.huid + + if item_detail.has_stone: + for stone in self.item_wise_stone_details: + aumms_item.append("stone_details", { + "stone_weight": stone.stone_weight, + "stone_charge": stone.rate * stone.stone_weight, + "item_name": stone.stone, + "stone_type": stone.stone + }) + + aumms_item.insert(ignore_permissions=True) + frappe.msgprint('AuMMS Item Created.', indicator="green", alert=1) + + + def create_purchase_receipt(self): + # Create a new Purchase Receipt + purchase_receipt = frappe.new_doc('Purchase Receipt') + purchase_receipt.supplier = self.supplier + # purchase_receipt.total_qty = self.quantity + purchase_receipt.keep_metal_ledger = 1 + + for item_detail in self.get("item_details"): + purchase_receipt.append('items', { + 'item_code': item_detail.item_code, + 'item_name': item_detail.item_code, + 'board_rate': self.board_rate, + 'qty': 1, + 'uom': "Nos", + "weight_per_unit": item_detail.gold_weight, + "weight_uom": item_detail.uom, + 'base_rate': item_detail.amount, + 'rate': item_detail.amount, + 'custom_making_charge': item_detail.making_charge, + 'custom_stone_weight': item_detail.stone_weight, + 'custom_stone_charge': item_detail.stone_charge, + + }) + purchase_receipt.insert(ignore_permissions=True) + purchase_receipt.submit() + frappe.msgprint('Purchase Receipt created.', indicator="green", alert=1) + + # except frappe.DuplicateEntryError as e: + # # Handle duplicate entry error + # frappe.msgprint(f'Duplicate entry error: {e}', indicator="red", alert=1) + # except Exception as ex: + # # Handle other exceptions + # frappe.msgprint(f'Error: {ex}', indicator="red", alert=1) + + def calculate_item_details(self): + for item_detail in self.get("item_details"): + # if item_detail.single_stone: + # if item_detail.stone_weight: + # item_detail.net_weight = item_detail.gold_weight + item_detail.stone_weight + # if item_detail.unit_stone_charge: + # item_detail.stone_charge = item_detail.unit_stone_charge * item_detail.stone_weight + # else: + # item_detail.net_weight = item_detail.gold_weight + if self.board_rate: + if item_detail.has_stone: + item_detail.amount_without_making_charge = (item_detail.gold_weight * self.board_rate) + item_detail.stone_charge + else: + item_detail.amount_without_making_charge = item_detail.gold_weight * self.board_rate + + if item_detail.amount_without_making_charge: + item_detail.making_charge = item_detail.amount_without_making_charge * (item_detail.making_chargein_percentage / 100) + + if item_detail.making_charge: + item_detail.amount = item_detail.amount_without_making_charge + item_detail.making_charge + frappe.db.commit() diff --git a/aumms/aumms/report/metal_ledger/metal_ledger.py b/aumms/aumms/report/metal_ledger/metal_ledger.py index 3d4e5c09..a7a0e39f 100644 --- a/aumms/aumms/report/metal_ledger/metal_ledger.py +++ b/aumms/aumms/report/metal_ledger/metal_ledger.py @@ -2,52 +2,124 @@ # For license information, please see license.txt from __future__ import unicode_literals + import frappe -from frappe.utils import * from frappe import _ -from aumms.aumms.utils import get_party_link_if_exist, get_conversion_factor +from frappe.utils.data import get_datetime, getdate + +from aumms.aumms.utils import get_conversion_factor, get_party_link_if_exist + def execute(filters=None): columns, data = get_columns(filters), get_data(filters) - return columns, data + report_summary = get_report_summary(filters) + return columns, data, None, None, report_summary + def get_columns(filters): - ''' Method to get columns in report ''' + """Method to get columns in report""" columns = [ - {'label': _('Posting Date'), 'fieldtype': 'Date', 'width': 110}, - {'label': _('Item Code'), 'fieldtype': 'Link', 'options': 'Item', 'width': 110}, - {'label': _('Party Type'), 'fieldname': 'party_type', 'fieldtype': 'Link', 'options': 'DocType'}, - {'label': _('Party'), 'fieldtype': 'Dynamic Link', 'options': 'party_type', 'width': 130}, - {'label': _('Item Type'), 'fieldtype': 'Link', 'options': 'Item Type', 'width': 100}, - {'label': _('Purity'), 'fieldtype': 'Link', 'options': 'Purity', 'width': 75}, - {'label': _('Stock UOM'), 'fieldtype': 'Link', 'options': 'UOM', 'width': 100}, - {'label': _('In Quantity'), 'fieldname': 'in_qty', 'fieldtype': 'Float', 'width': 100}, - {'label': _('Out Quantity'), 'fieldname': 'out_qty', 'fieldtype': 'Float', 'width': 120}, - {'label': _('Voucher Type'), 'fieldtype': 'Link', 'options': 'DocType', 'fieldname': 'voucher_type', 'hidden': 1}, - {'label': _('Voucher No'), 'fieldtype': 'Dynamic Link', 'options': 'voucher_type', 'width': 200}, - {'label': _('Incoming Rate'), 'fieldname': 'in_rate', 'fieldtype': 'Currency', 'width': 120}, - {'label': _('Outgoing Rate'), 'fieldname': 'out_rate', 'fieldtype': 'Currency', 'width': 120}, - {'label': _('Amount'), 'fieldname': 'amount', 'fieldtype': 'Currency', 'width': 110}, - {'label': _('Posting Time'), 'fieldtype': 'Time', 'width': 110}, - ] + {"label": _("Posting Date"), "fieldtype": "Date", "width": 110}, + {"label": _("Item Code"), "fieldtype": "Link", "options": "Item", "width": 110}, + { + "label": _("Party Type"), + "fieldname": "party_type", + "fieldtype": "Link", + "options": "DocType", + }, + { + "label": _("Party"), + "fieldtype": "Dynamic Link", + "options": "party_type", + "width": 130, + }, + { + "label": _("Item Type"), + "fieldtype": "Link", + "options": "Item Type", + "width": 100, + }, + { + "label": _("Purity of Transaction"), + "fieldtype": "Link", + "options": "Purity", + "width": 175, + }, + {"label": _("Weight UOM"), "fieldtype": "Link", "options": "UOM", "width": 100}, + { + "label": _("In Quantity"), + "fieldname": "in_qty", + "fieldtype": "Float", + "width": 100, + }, + { + "label": _("Out Quantity"), + "fieldname": "out_qty", + "fieldtype": "Float", + "width": 120, + }, + { + "label": _("Voucher Type"), + "fieldtype": "Link", + "options": "DocType", + "fieldname": "voucher_type", + "hidden": 1, + }, + { + "label": _("Voucher No"), + "fieldtype": "Dynamic Link", + "options": "voucher_type", + "width": 200, + }, + { + "label": _("Incoming Rate"), + "fieldname": "in_rate", + "fieldtype": "Currency", + "width": 120, + }, + { + "label": _("Outgoing Rate"), + "fieldname": "out_rate", + "fieldtype": "Currency", + "width": 120, + }, + { + "label": _("Amount"), + "fieldname": "amount", + "fieldtype": "Currency", + "width": 110, + }, + {"label": _("Posting Time"), "fieldtype": "Time", "width": 110}, + ] if filters.purity and filters.uom: - columns.insert(9, {'label': _('Balance Quantity'), 'fieldname': 'balance_qty', 'fieldtype': 'Float', 'width': 150}) + columns.insert( + 9, + { + "label": _("Balance Quantity"), + "fieldname": "balance_qty", + "fieldtype": "Float", + "width": 150, + }, + ) return columns + def get_data(filters): - ''' Method to get data ''' + """Method to get data""" get_filters(filters) data = [] - metal_ledger_entry_list = frappe.get_all('Metal Ledger Entry', order_by='creation desc', filters=get_filters(filters)) + metal_ledger_entry_list = frappe.get_all( + "Metal Ledger Entry", order_by="creation desc", filters=get_filters(filters) + ) for metal_ledger_entry in metal_ledger_entry_list: - doc = frappe.get_doc('Metal Ledger Entry', metal_ledger_entry.name) + doc = frappe.get_doc("Metal Ledger Entry", metal_ledger_entry.name) row = [ doc.posting_date, doc.item_code, doc.party_type, doc.party, doc.item_type, - doc.purity, + doc.purity or "22k", # CHANGE THIS! doc.stock_uom, doc.in_qty, doc.out_qty, @@ -56,27 +128,37 @@ def get_data(filters): doc.incoming_rate, doc.outgoing_rate, doc.amount, - doc.posting_time + doc.posting_time, ] + if filters.purity: + row[7], row[8] = get_purity_converted_qty( + doc.purity, doc.in_qty, doc.out_qty, filters.purity + ) if filters.purity and filters.uom: - balance_qty = get_balance_qty(doc.creation, doc.item_type, doc.party_link, filters.purity, filters.uom) + balance_qty = get_balance_qty( + doc.creation, filters.purity, filters.uom, doc.item_type, doc.party_link + ) row.insert(9, balance_qty) data.append(row) return data + def get_filters(filters): - ''' Method to get filters ''' + """Method to get filters""" conditions = {} if filters.company: - conditions['company'] = filters.company + conditions["company"] = filters.company if filters.from_date and filters.to_date: - conditions['posting_date'] = [ 'between' , [ getdate(filters.from_date), getdate(filters.to_date) ] ] + conditions["posting_date"] = [ + "between", + [getdate(filters.from_date), getdate(filters.to_date)], + ] if filters.item_code: - conditions['item_code'] = filters.item_code + conditions["item_code"] = filters.item_code if filters.item_type: - conditions['item_type'] = filters.item_type + conditions["item_type"] = filters.item_type if filters.party_type and not filters.party: - conditions['party_type'] = filters.party_type + conditions["party_type"] = filters.party_type if filters.party: # to show common party accounts @@ -84,49 +166,60 @@ def get_filters(filters): # get party link of this party party_link = get_party_link_if_exist(filters.party_type, filters.party) - conditions['party_link'] = party_link + conditions["party_link"] = party_link else: # update condition with party - conditions['party'] = filters.party + conditions["party"] = filters.party if filters.voucher_type: - conditions['voucher_type'] = filters.voucher_type + conditions["voucher_type"] = filters.voucher_type if filters.voucher_no: - conditions['voucher_no'] = filters.voucher_no + conditions["voucher_no"] = filters.voucher_no if filters.item_type: - conditions['item_type'] = filters.item_type + conditions["item_type"] = filters.item_type if conditions: return conditions else: return [] -def get_balance_qty(creation, item_type, party_link, purity, uom): + +def get_balance_qty( + creation, purity, uom, item_type=None, party_link=None, from_datetime=None +): """ - method to get balance qty of a an item type of a - common account party with conversion of purity and uom - args: - creation: creation datetime of ledger document - item_type: item type link - party_link: name of party link - purity: purity set in the filter - uom: uom set in the filter - output: balance qty of an item type of a common account party in filter uom and purity + method to get balance qty of a an item type of a + common account party with conversion of purity and uom + args: + creation: creation datetime of ledger document + item_type: item type link + party_link: name of party link + purity: purity set in the filter + uom: uom set in the filter + output: balance qty of an item type of a common account party in filter uom and purity """ - ledgers = frappe.db.get_all('Metal Ledger Entry', - filters = { - 'creation': ['<=', creation], - 'item_type': item_type, - 'party_link': party_link, - 'is_cancelled': 0 - }, - fields = [ - 'in_qty', 'out_qty', 'stock_uom', 'purity_percentage', 'purity' + filters_dict = { + "creation": ["<=", get_datetime(creation)], + "is_cancelled": 0, + } + if from_datetime: + filters_dict["creation"] = [ + "between", + [get_datetime(from_datetime), get_datetime(creation)], ] + if item_type: + filters_dict["item_type"] = item_type + if party_link: + filters_dict["party"] = party_link + print("\n", filters_dict, "\n") + ledgers = frappe.db.get_all( + "Metal Ledger Entry", + filters=filters_dict, + fields=["in_qty", "out_qty", "stock_uom", "purity_percentage", "purity"], ) balance = 0 - purity_percentage = frappe.db.get_value('Purity', purity, 'purity_percentage') + purity_percentage = frappe.db.get_value("Purity", purity, "purity_percentage") for ledger in ledgers: qty = ledger.in_qty if ledger.in_qty else -ledger.out_qty @@ -136,18 +229,81 @@ def get_balance_qty(creation, item_type, party_link, purity, uom): balance += qty else: # convert purity - purity_converted_qty = (qty * float(ledger.purity_percentage))/float(purity_percentage) + purity_converted_qty = (qty * float(ledger.purity_percentage)) / float( + purity_percentage + ) balance += purity_converted_qty else: # update qty with conversion factor conversion_factor = get_conversion_factor(ledger.stock_uom, uom) if not conversion_factor: - frappe.throw(_('Please set Conversion Factor for {0} to {1}'.format(ledger.stock_uom, uom))) + frappe.throw( + _( + "Please set Conversion Factor for {0} to {1}".format( + ledger.stock_uom, uom + ) + ) + ) qty *= conversion_factor if ledger.purity == purity: balance += qty else: # convert purity - purity_converted_qty = (qty * float(ledger.purity_percentage))/float(purity_percentage) + purity_converted_qty = (qty * float(ledger.purity_percentage)) / float( + purity_percentage + ) balance += purity_converted_qty return balance + + +def get_purity_converted_qty(ledger_purity, in_qty, out_qty, filter_purity): + if ledger_purity == filter_purity: + return in_qty, out_qty + ledger_purity_percentage = frappe.db.get_value( + "Purity", ledger_purity, "purity_percentage" + ) + filter_purity_percentage = frappe.db.get_value( + "Purity", filter_purity, "purity_percentage" + ) + purity_converted_in_qty = 0 + if not ledger_purity_percentage: + ledger_purity_percentage = 91.67 # CHANGE THIS! + if in_qty: + purity_converted_in_qty = ( + in_qty * ledger_purity_percentage + ) / filter_purity_percentage + purity_converted_out_qty = ( + out_qty * ledger_purity_percentage + ) / filter_purity_percentage + return purity_converted_in_qty, purity_converted_out_qty + + +def get_report_summary(filters): + """Generates Report Summary object + + Args: + filters (frappe dict): contains filters selected in the report + + Returns: + list of dict: each dict containing the details of summary to be displayed + """ + report_summary = [] + + opening_balance = get_balance_qty( + filters.to_date, + filters.purity if filters.purity else "22k", + filters.uom if filters.uom else "Gram", + None, + filters.party, + filters.from_date, + ) + + report_summary.append( + { + "value": opening_balance, + "indicator": "Green" if opening_balance > 0 else "Red", + "label": _("Opening Balance"), + "datatype": "Float", + } + ) + return report_summary diff --git a/aumms/aumms/utils.py b/aumms/aumms/utils.py index 23babf69..e1b450f4 100644 --- a/aumms/aumms/utils.py +++ b/aumms/aumms/utils.py @@ -68,7 +68,7 @@ def create_metal_ledger_entries(doc, method=None): 'voucher_type': doc.doctype, 'voucher_no': doc.name, 'company': company, - 'party_link': doc.party_link + # 'party_link': doc.party_link } # set party type and party in fields if doctype is Purchase Receipt @@ -86,30 +86,32 @@ def create_metal_ledger_entries(doc, method=None): # declare ledger_created as false ledger_created = 0 for item in doc.items: + + aumms_item_doc = frappe.get_doc("AuMMS Item", item.item_code) # set item details in fields fields['item_code'] = item.item_code fields['item_name'] = item.item_name - fields['stock_uom'] = item.stock_uom - fields['purity'] = item.purity - fields['purity_percentage'] = item.purity_percentage + fields['stock_uom'] = item.weight_uom + fields['purity'] = aumms_item_doc.purity + fields['purity_percentage'] = aumms_item_doc.purity_percentage fields['board_rate'] = item.rate fields['batch_no'] = item.batch_no - fields['item_type'] = item.item_type + fields['item_type'] = aumms_item_doc.item_type # get balance qty of the item for this party filters = { - 'item_type': item.item_type, - 'purity': item.purity, - 'stock_uom': item.stock_uom, - 'party_link': doc.party_link, + 'item_type': aumms_item_doc.item_type, + 'purity': aumms_item_doc.purity, + 'stock_uom': item.weight_uom, + # 'party_link': doc.party_link, 'is_cancelled': 0 } balance_qty = frappe.db.get_value('Metal Ledger Entry', filters, 'balance_qty') if doc.doctype == 'Purchase Receipt': # update balance_qty - balance_qty = balance_qty+item.stock_qty if balance_qty else item.stock_qty - fields['in_qty'] = item.stock_qty + balance_qty = balance_qty+item.total_weight if balance_qty else item.total_weight + fields['in_qty'] = item.total_weight fields['outgoing_rate'] = item.rate fields['balance_qty'] = balance_qty fields['amount'] = -item.amount diff --git a/aumms/aumms/workspace/aumms/aumms.json b/aumms/aumms/workspace/aumms/aumms.json index 860c3364..32bedde8 100644 --- a/aumms/aumms/workspace/aumms/aumms.json +++ b/aumms/aumms/workspace/aumms/aumms.json @@ -5,7 +5,7 @@ "label": "Last Month Board Rate" } ], - "content": "[{\"id\":\"xytMzcNTlF\",\"type\":\"header\",\"data\":{\"text\":\"AuMMS\",\"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\":\"AuMMS Manufacturing\",\"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\":\"Reports & Masters\",\"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\":\"AuMMS\",\"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\":\"e9B31_-by6\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Jewellery Receipt\",\"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\":\"AuMMS Manufacturing\",\"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\":\"Reports & Masters\",\"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, @@ -152,7 +152,7 @@ "type": "Link" } ], - "modified": "2024-05-06 10:24:40.490084", + "modified": "2024-08-16 09:28:21.176711", "modified_by": "Administrator", "module": "AuMMS", "name": "AuMMS", @@ -164,6 +164,14 @@ "roles": [], "sequence_id": 1.0, "shortcuts": [ + { + "color": "Grey", + "doc_view": "List", + "label": "Jewellery Receipt", + "link_to": "Jewellery Receipt", + "stats_filter": "[]", + "type": "DocType" + }, { "color": "Grey", "doc_view": "List", diff --git a/aumms/hooks.py b/aumms/hooks.py index 6b62ff47..a38cba50 100644 --- a/aumms/hooks.py +++ b/aumms/hooks.py @@ -1,4 +1,3 @@ -from . import __version__ as app_version app_name = "aumms" app_title = "AuMMS" @@ -101,15 +100,15 @@ }, { "dt":"Workflow", - "filters":[["name","in",["Feasibility check"]]] + "filters":[["name","in",["Feasibility check", "Touch Validation Workflow", "Purchase Receipt Workflow","Hallmark Request Workflow"]]] }, { "dt":"Workflow Action Master", - "filters":[["name","in",["Submit for Feasibility check", "Approve", "Reject", "Submit", "Cancel"]]] + "filters":[["name","in",["Send for Hallmarking", "Hallmark Items Return", "Submit for Feasibility check", "Approve", "Reject", "Submit", "Cancel", "Review"]]] }, { "dt":"Workflow State", - "filters":[["name","in",["Draft", "Submitted for feasibility", "Feasible", "Not Feasible", "Submitted", "Cancelled"]]] + "filters":[["name","in",["Draft", "Submitted", "Sent for Hallmarking", "Send for Hallmarking", "Items Hallmarked", "Submitted for feasibility", "Feasible", "Not Feasible", "Submitted", "Cancelled", "Manager Approved", "Manager Rejected", "Director Approved", "Director Rejected", "Sent to Director", "Sent to Manager"]]] }, { "dt":"Custom Field", @@ -183,6 +182,10 @@ }, 'Work Order':{ 'after_insert' : 'aumms.aumms.doc_events.work_order.change_design_analysis_status' + }, + 'Stock Reconciliation': { + 'on_submit': 'aumms.aumms.doc_events.stock_reconciliation.create_mle_against_sr', + 'on_cancel': 'aumms.aumms.doc_events.stock_reconciliation.reverse_mle_against_sr', } } From 561fd5fbc71fa8acad04e6fda184121d92a13efb Mon Sep 17 00:00:00 2001 From: ajmalroshan123 Date: Fri, 1 Nov 2024 12:11:00 +0530 Subject: [PATCH 02/15] feat: all changes of aumms --- aumms/aumms/doctype/aumms_item/aumms_item.py | 35 +- .../jewellery_invoice/jewellery_invoice.js | 433 ++++++++++++++---- .../jewellery_invoice/jewellery_invoice.py | 48 +- aumms/aumms/utils.py | 6 + 4 files changed, 428 insertions(+), 94 deletions(-) diff --git a/aumms/aumms/doctype/aumms_item/aumms_item.py b/aumms/aumms/doctype/aumms_item/aumms_item.py index 654fa1c7..ea4a24c9 100644 --- a/aumms/aumms/doctype/aumms_item/aumms_item.py +++ b/aumms/aumms/doctype/aumms_item/aumms_item.py @@ -5,6 +5,7 @@ import frappe from frappe.model.document import Document +from frappe.utils import getdate # Fields used to map AuMMS Item to Item aumms_item_fields = [ @@ -171,19 +172,41 @@ def create_opening_stock_from_list(item_list_json): return "Opening stock creation has been enqueued." + + def create_opening_stock(item_list): - for item in item_list: + warehouse = frappe.db.exists("Warehouse", {"name": ["like", "%Stores%"]}) + account = frappe.db.exists("Account", {"name": ["like", "%Temporary Opening%"]}) + + + current_date = getdate() + + for item_name in item_list: + + aumms_item = frappe.get_doc("AuMMS Item", item_name) + + board_rate = frappe.db.get_value('Board Rate', + { + 'item_type': aumms_item.item_type, + 'purity': aumms_item.purity, + 'date': current_date + }, + 'board_rate') + try: doc = frappe.new_doc("Stock Reconciliation") doc.purpose = "Opening Stock" - doc.expense_account = "Temporary Opening - A" + doc.expense_account = account + + doc.date = current_date + doc.append( "items", { - "item_code": item, - "warehouse": "Stores - A", - "qty": 5, - "valuation_rate": 10000000, + "item_code": aumms_item.item_code, + "warehouse": warehouse, + "qty": 1, + "valuation_rate": board_rate * aumms_item.gold_weight if board_rate else 0, }, ) doc.insert(ignore_permissions=True) diff --git a/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.js b/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.js index 7b442cd9..7dc6e13d 100644 --- a/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.js +++ b/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.js @@ -32,19 +32,22 @@ frappe.ui.form.on('Jewellery Invoice', { }) } }, - validate: function(frm){ - set_totals(frm); - }, - disable_rounded_total: function(frm){ - if(frm.doc.disable_rounded_total){ - frm.set_value('rounding_adjustment', 0); - } - else{ - frm.set_value('rounded_total', Math.round(frm.doc.grand_total)); - frm.set_value('rounding_adjustment', frm.doc.rounded_total - frm.doc.grand_total); - } - frm.set_value('rounded_total', frm.doc.grand_total+frm.doc.rounding_adjustment); - }, + // validate: function(frm){ + // set_totals(frm); + // }, + + // edit by aj + + // disable_rounded_total: function(frm){ + // if(frm.doc.disable_rounded_total){ + // frm.set_value('rounding_adjustment', 0); + // } + // else{ + // frm.set_value('rounded_total', Math.round(frm.doc.grand_total)); + // frm.set_value('rounding_adjustment', frm.doc.rounded_total - frm.doc.grand_total); + // } + // frm.set_value('rounded_total', frm.doc.grand_total+frm.doc.rounding_adjustment); + // }, delivery_date: function(frm){ if(frm.doc.delivery_date){ set_missing_delivery_dates(frm); @@ -96,10 +99,13 @@ frappe.ui.form.on('Jewellery Invoice', { } }); +// edited by aj frappe.ui.form.on('Old Jewellery Item', { item_code: function(frm, cdt, cdn) { let d = locals[cdt][cdn]; + if (d.item_code && d.purity && d.stock_uom) { + frappe.call({ method: 'aumms.aumms.utils.get_board_rate', args: { @@ -151,52 +157,113 @@ frappe.ui.form.on('Old Jewellery Item', { } }); +// aj + frappe.ui.form.on('Jewellery Invoice Item', { - item_code: function(frm, cdt, cdn){ +// item_code: function(frm, cdt, cdn){ +// console.log("here-1"); +// let d = locals[cdt][cdn]; +// if (d.item_code){ +// if(frm.doc.delivery_date){ +// frappe.model.set_value(d.doctype, d.name, 'delivery_date', frm.doc.delivery_date); +// } +// if (d.is_purity_item){ +// frappe.call({ +// // Method for fetching gold_weight, making_charge_percentage, making_charge & board_rate +// method: 'aumms.aumms.doc_events.sales_order.get_item_details', +// args: { +// 'item_code': d.item_code, +// 'item_type': d.item_type, +// 'date': frm.doc.transaction_date, +// 'purity': d.purity, +// 'stock_uom': d.stock_uom +// }, +// callback: function(r) { +// if (r.message){ +// frappe.model.set_value(d.doctype, d.name, 'gold_weight', r.message['gold_weight']); +// frappe.model.set_value(d.doctype, d.name, 'stone_weight', r.message['stone_weight']); +// frappe.model.set_value(d.doctype, d.name, 'net_weight', r.message['net_weight']); +// frappe.model.set_value(d.doctype, d.name, 'stone_charge', r.message['stone_charge']); +// frappe.model.set_value(d.doctype, d.name, 'making_charge_percentage', r.message['making_charge_percentage']); +// frappe.model.set_value(d.doctype, d.name, 'is_fixed_making_charge', r.message['making_charge']); +// frappe.model.set_value(d.doctype, d.name, 'board_rate', r.message['board_rate']); +// frappe.model.set_value(d.doctype, d.name, 'making_charge_based_on', r.message['making_charge_based_on']); +// frappe.model.set_value(d.doctype, d.name, 'making_charge_percentage', r.message['making_charge_percentage']); +// frappe.model.set_value(d.doctype, d.name, 'amount_with_out_making_charge', r.message['gold_weight'] * r.message['board_rate']); +// frappe.model.set_value(d.doctype, d.name, 'net_amount_with_out_making_charge', (r.message['gold_weight'] * r.message['board_rate']) + r.message['stone_charge']); +// if (r.message['making_charge']){ +// frappe.model.set_value(d.doctype, d.name, 'making_charge', r.message['making_charge']); +// } +// else { +// //set making_charge if it's percentage +// frappe.model.set_value(d.doctype, d.name, 'making_charge', (d.amount_with_out_making_charge)*(d.making_charge_percentage * 0.01)); +// } +// frappe.model.set_value(d.doctype, d.name, 'rate', (d.net_amount_with_out_making_charge + d.making_charge)/d.gold_weight); +// frm.refresh_field('items'); +// } +// } +// }) +// } +// } + + + // code to fetch stone details aj +// }, + item_code: function(frm, cdt, cdn) { let d = locals[cdt][cdn]; - if (d.item_code){ - if(frm.doc.delivery_date){ - frappe.model.set_value(d.doctype, d.name, 'delivery_date', frm.doc.delivery_date); - } - if (d.is_purity_item){ + + if (d.item_code) { frappe.call({ - // Method for fetching gold_weight, making_charge_percentage, making_charge & board_rate - method: 'aumms.aumms.doc_events.sales_order.get_item_details', - args: { - 'item_code': d.item_code, - 'item_type': d.item_type, - 'date': frm.doc.transaction_date, - 'purity': d.purity, - 'stock_uom': d.stock_uom - }, - callback: function(r) { - if (r.message){ - frappe.model.set_value(d.doctype, d.name, 'gold_weight', r.message['gold_weight']); - frappe.model.set_value(d.doctype, d.name, 'stone_weight', r.message['stone_weight']); - frappe.model.set_value(d.doctype, d.name, 'net_weight', r.message['net_weight']); - frappe.model.set_value(d.doctype, d.name, 'stone_charge', r.message['stone_charge']); - frappe.model.set_value(d.doctype, d.name, 'making_charge_percentage', r.message['making_charge_percentage']); - frappe.model.set_value(d.doctype, d.name, 'is_fixed_making_charge', r.message['making_charge']); - frappe.model.set_value(d.doctype, d.name, 'board_rate', r.message['board_rate']); - frappe.model.set_value(d.doctype, d.name, 'making_charge_based_on', r.message['making_charge_based_on']); - frappe.model.set_value(d.doctype, d.name, 'making_charge_percentage', r.message['making_charge_percentage']); - frappe.model.set_value(d.doctype, d.name, 'amount_with_out_making_charge', r.message['gold_weight'] * r.message['board_rate']); - frappe.model.set_value(d.doctype, d.name, 'net_amount_with_out_making_charge', (r.message['gold_weight'] * r.message['board_rate']) + r.message['stone_charge']); - if (r.message['making_charge']){ - frappe.model.set_value(d.doctype, d.name, 'making_charge', r.message['making_charge']); - } - else { - //set making_charge if it's percentage - frappe.model.set_value(d.doctype, d.name, 'making_charge', (d.amount_with_out_making_charge)*(d.making_charge_percentage * 0.01)); - } - frappe.model.set_value(d.doctype, d.name, 'rate', (d.net_amount_with_out_making_charge + d.making_charge)/d.gold_weight); - frm.refresh_field('items'); + method: "frappe.client.get", + args: { + doctype: "AuMMS Item", + name: d.item_code + }, + callback: function(r) { + if (r.message) { + let stone_details = r.message.stone_details; + + $.each(stone_details, function(index, row) { + let child = frm.add_child('custom_stone_detail_'); + child.item_code = d.item_code; + child.item_name = row.item_name; + child.stone_type = row.stone_type; + child.stone_weight = row.stone_weight; + child.stone_charge = row.stone_charge; + }); + + frm.refresh_field('custom_stone_detail_'); + } } - } - }) - } + }); } - }, +}, + // item_code: function(frm, cdt, cdn) { + // let d = locals[cdt][cdn]; + + // if (d.item_code) { + // frappe.db.get_list('Stone Details', { + // fields: ['item_name', 'stone_type', 'stone_weight', 'stone_charge'], + // filters: { + // parent: d.item_code + // } + // }).then(records => { + + // records.forEach(record => { + + // let child = frm.add_child('custom_stone_detail_'); + // child.item_name = record.item_name; + // child.stone_type = record.stone_type; + // child.stone_weight = record.stone_weight; + // child.stone_charge = record.stone_charge; + // }); + + // frm.refresh_field('custom_stone_detail_'); + // }); + // } + + + gold_weight: function(frm, cdt, cdn){ let d = locals[cdt][cdn]; let total_gold_weight; @@ -224,7 +291,7 @@ frappe.ui.form.on('Jewellery Invoice Item', { }, amount: function(frm, cdt, cdn) { set_net_weight_and_amount(frm); - set_totals(frm); + // set_totals(frm); }, making_charge_percentage: function(frm, cdt, cdn){ let d = locals[cdt][cdn]; @@ -239,7 +306,7 @@ frappe.ui.form.on('Jewellery Invoice Item', { let d = locals[cdt][cdn]; if (d.amount_with_out_making_charge){ frappe.model.set_value(d.doctype, d.name, 'net_amount_with_out_making_charge', d.amount_with_out_making_charge + d.stone_charge); - var making_charge = d.amount_with_out_making_charge * d.making_charge_percentage * 0.01 + let making_charge = d.amount_with_out_making_charge * d.making_charge_percentage * 0.01 frappe.model.set_value(d.doctype, d.name, 'making_charge', making_charge);//set making_charge while changing of amount_with_out_making_charge let rate = (d.net_amount_with_out_making_charge + d.making_charge)/d.gold_weight if (rate) @@ -299,11 +366,11 @@ frappe.ui.form.on('Jewellery Invoice Item', { frappe.model.set_value(child.doctype, child.name, 'delivery_date', frm.doc.delivery_date); } frm.refresh_field('items'); - set_totals(frm); + // set_totals(frm); set_net_weight_and_amount(frm); }, items_remove: function(frm, cdt, cdn) { - set_totals(frm); + // set_totals(frm); set_net_weight_and_amount(frm); } }); @@ -315,7 +382,7 @@ let set_item_details = function(frm, child) { method : 'aumms.aumms.utils.get_board_rate', args: { item_type: child.item_type, - date: cur_frm.doc.transaction_date, + date: frm.doc.transaction_date, stock_uom: child.stock_uom, purity: child.purity }, @@ -376,55 +443,97 @@ let set_filters = function(frm){ }); } -let set_totals = function(frm){ - let total = 0; - if(frm.doc.items){ - frm.doc.items.forEach((child) => { - if(child.amount){ - total = total + child.amount; - } - }); - } - frm.set_value('grand_total', total); - frm.set_value('rounded_total', total); - frm.refresh_fields(); -} +// let set_totals = function(frm){ +// let total = 0; +// if(frm.doc.items){ +// frm.doc.items.forEach((child) => { +// if(child.amount){ +// total = total + child.amount; +// } +// }); +// } +// frm.set_value('grand_total', total); +// frm.set_value('rounded_total', total); +// frm.refresh_fields(); +// } -let set_net_weight_and_amount = function(frm){ +let set_net_weight_and_amount = function(frm) { let total_old_gold_weight = 0; let total_gold_weight = 0; let total_old_gold_amount = 0; - let total_gold_amount = 0; + let total_gold_amount = 0; let balance_amount = 0; - if(frm.doc.items){ + + if (frm.doc.items) { frm.doc.items.forEach((child) => { - if(child.gold_weight){ - total_gold_weight = total_gold_weight + child.gold_weight; + if (child.gold_weight) { + total_gold_weight += child.gold_weight; } - if(child.amount){ - total_gold_amount = total_gold_amount + child.amount; + if (typeof child.amount === 'number' && !isNaN(child.amount)) { // Check if amount is a valid number + total_gold_amount += child.amount; // Calculate total_gold_amount } }); } - if(frm.doc.transaction_type!='Sales' && frm.doc.old_jewellery_items){ + + if (frm.doc.transaction_type !== 'Sales' && frm.doc.old_jewellery_items) { frm.doc.old_jewellery_items.forEach((child) => { - if(child.weight){ - total_old_gold_weight = total_old_gold_weight + child.weight; + if (child.weight) { + total_old_gold_weight += child.weight; } - if(child.amount){ - total_old_gold_amount = total_old_gold_amount + child.amount; + if (typeof child.amount === 'number' && !isNaN(child.amount)) { // Check if amount is a valid number + total_old_gold_amount += child.amount; } }); } - balance_amount = total_gold_amount - total_old_gold_amount + + balance_amount = total_gold_amount - total_old_gold_amount; + + // Set values in the form frm.set_value('total_gold_weight', total_gold_weight); frm.set_value('total_gold_amount', total_gold_amount); frm.set_value('total_old_gold_weight', total_old_gold_weight); frm.set_value('total_old_gold_amount', total_old_gold_amount); frm.set_value('balance_amount', balance_amount); + frm.refresh_fields(); } + +// let set_net_weight_and_amount = function(frm){ +// let total_old_gold_weight = 0; +// let total_gold_weight = 0; +// let total_old_gold_amount = 0; +// let total_gold_amount = 0; +// let balance_amount = 0; +// if(frm.doc.items){ +// frm.doc.items.forEach((child) => { +// if(child.gold_weight){ +// total_gold_weight = total_gold_weight + child.gold_weight; +// } +// if(child.amount){ +// total_gold_amount = total_gold_amount + child.amount; +// } +// }); +// } +// if(frm.doc.transaction_type!='Sales' && frm.doc.old_jewellery_items){ +// frm.doc.old_jewellery_items.forEach((child) => { +// if(child.weight){ +// total_old_gold_weight = total_old_gold_weight + child.weight; +// } +// if(child.amount){ +// total_old_gold_amount = total_old_gold_amount + child.amount; +// } +// }); +// } +// balance_amount = total_gold_amount - total_old_gold_amount +// frm.set_value('total_gold_weight', total_gold_weight); +// frm.set_value('total_gold_amount', total_gold_amount); +// frm.set_value('total_old_gold_weight', total_old_gold_weight); +// frm.set_value('total_old_gold_amount', total_old_gold_amount); +// frm.set_value('balance_amount', balance_amount); +// frm.refresh_fields(); +// } + let set_missing_delivery_dates = function(frm){ if(frm.doc.items){ frm.doc.items.forEach((child) => { @@ -623,3 +732,157 @@ let get_customer_advances= function(frm){ }); }); } + + + +// code to fetch the Item details by aj + +frappe.ui.form.on('Jewellery Invoice Item', { + item_code: function(frm, cdt, cdn) { + let d = locals[cdt][cdn]; + + if (d.item_code) { + + if (frm.doc.delivery_date) { + frappe.model.set_value(d.doctype, d.name, 'delivery_date', frm.doc.delivery_date); + } + + // Step 1: Fetch making_charge + fetch_and_set_making_charge(frm, d); + + // Step 2: Fetch item details for purity items + if (d.is_purity_item) { + frappe.call({ + method: 'aumms.aumms.doc_events.sales_order.get_item_details', + args: { + 'item_code': d.item_code, + 'item_type': d.item_type, + 'date': frm.doc.transaction_date, + 'purity': d.purity, + 'stock_uom': d.stock_uom + }, + callback: function(r) { + if (r.message) { + frappe.model.set_value(d.doctype, d.name, 'gold_weight', r.message['gold_weight']); + frappe.model.set_value(d.doctype, d.name, 'stone_weight', r.message['stone_weight']); + frappe.model.set_value(d.doctype, d.name, 'net_weight', r.message['net_weight']); + frappe.model.set_value(d.doctype, d.name, 'stone_charge', r.message['stone_charge']); + frappe.model.set_value(d.doctype, d.name, 'making_charge_percentage', r.message['making_charge_percentage']); + frappe.model.set_value(d.doctype, d.name, 'board_rate', r.message['board_rate']); + frappe.model.set_value(d.doctype, d.name, 'making_charge_based_on', r.message['making_charge_based_on']); + + // Calculate amount without making charge + let amount_without_making_charge = r.message['gold_weight'] * r.message['board_rate']; + frappe.model.set_value(d.doctype, d.name, 'amount_with_out_making_charge', amount_without_making_charge); + + // Calculate net amount without making charge + let net_amount_without_making_charge = amount_without_making_charge + r.message['stone_charge']; + frappe.model.set_value(d.doctype, d.name, 'net_amount_with_out_making_charge', net_amount_without_making_charge); + + // Set rate using the making_charge already fetched earlier + let making_charge = d.making_charge || 0; + let total_rate = (net_amount_without_making_charge + making_charge) / r.message['gold_weight']; + frappe.model.set_value(d.doctype, d.name, 'rate', total_rate); + + frm.refresh_field('items'); + } + } + }); + } + + // Step 3: Fetch board_rate + if (d.purity && d.stock_uom) { + frappe.call({ + method: 'aumms.aumms.utils.get_board_rate', + args: { + 'item_type': d.item_type, + 'date': frm.doc.transaction_date, + 'purity': d.purity, + 'stock_uom': d.stock_uom + }, + callback: function(r) { + if (r.message) { + let board_rate = r.message; + frappe.model.set_value(d.doctype, d.name, 'board_rate', board_rate); + frm.refresh_field('items'); + } + } + }); + } + } + } +}); + +//fetching making_charge +function fetch_and_set_making_charge(frm, d) { + frappe.call({ + method: "aumms.aumms.doctype.jewellery_invoice.jewellery_invoice.get_making_charge", + args: { + item_code: d.item_code + }, + callback: function(r) { + if (r.message) { + frappe.model.set_value(d.doctype, d.name, 'making_charge', r.message); + console.log(r.message, 'Fetched making_charge'); + + } + frm.refresh_field('items'); + } + }); +}; + + +// code by aj +// discount + +frappe.ui.form.on('Stone Detals - 2', { + discount: function(frm, cdt, cdn) { + calculate_discount_and_total(frm, cdt, cdn); + } +}); + +function calculate_discount_and_total(frm, cdt, cdn) { + let row = locals[cdt][cdn]; + let discounted_amount = flt(row.stone_charge) * (1 - flt(row.discount) / 100); + + // Update the row's final discounted amount + frappe.model.set_value(cdt, cdn, 'custom_discount_final', discounted_amount); + + // Calculate and set the total discounted amount + let total = frm.doc.custom_stone_detail_.reduce((sum, r) => + sum + flt(r.stone_charge) * (1 - flt(r.discount) / 100), 0); + + frm.set_value('custom_discount_final', total); + frm.refresh_fields(['custom_stone_detail_', 'custom_discount_final']); +} + + +// code to set Grand Total by aj + +frappe.ui.form.on('Jewellery Invoice', { + items: { + board_rate: calculate_total, + gold_weight: calculate_total, + making_charge: calculate_total, + items_add: calculate_total, + items_remove: calculate_total + }, + custom_discount_final: function(frm) { + calculate_total(frm); + } +}); + +function calculate_total(frm) { + let total_amount = 0; + let discount = frm.doc.custom_discount_final || 0; + + // Sum up for all items in the table + frm.doc.items.forEach(function(item) { + total_amount += (item.board_rate || 0) * (item.gold_weight || 0) + (item.making_charge || 0); + }); + + frm.set_value('grand_total', total_amount + discount); + frm.set_value('rounded_total', grand_total) + +} + diff --git a/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.py b/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.py index 890b876b..409c743e 100644 --- a/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.py +++ b/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.py @@ -57,12 +57,11 @@ def set_total_amount(self): if item.amount is not None: amount += item.amount currency = self.currency - self.grand_total = amount if self.disable_rounded_total: - self.rounded_total = amount + # self.rounded_total = amount self.rounding_adjustment = 0 else: - self.rounded_total = round(amount) + self.rounded_total = round(self.grand_total) self.rounding_adjustment = self.rounded_total - amount self.in_words = money_in_words(self.rounded_total, currency) self.outstanding_amount = self.rounded_total - self.paid_amount @@ -152,6 +151,12 @@ def set_missing_values(source, target): }, }, }, target_doc, set_missing_values) + # Setting the discount amount + try: + Jewellery = frappe.get_doc("Jewellery Invoice", source_name) + target_doc.discount_amount = abs(Jewellery.rounding_adjustment) + except Exception as e: + frappe.log_error("ERROR OCCURED", e) target_doc.submit() frappe.msgprint(('Sales Order created'), indicator="green", alert=1) frappe.db.commit() @@ -412,9 +417,11 @@ def get_board_rate(old_item, transaction_date): # Fetch the boardrate from the 'Board Rate' doctype board_rate = frappe.db.get_value('Board Rate', {'old_item': old_item, 'valid_from': ('<=', transaction_date)}, 'board_rate', order_by='valid_from desc', as_dict=True) + print(board_rate) return {'board_rate': board_rate} + @frappe.whitelist() def create_delivery_note(source_name, jewellery_invoice, target_doc=None): ''' Method to create Delivery Note from Jewellery Invoice with Sales Invoice reference ''' @@ -494,3 +501,38 @@ def get_sales_taxes_and_charges_details(sales_taxes_and_charges_template, total_ total_taxes_and_charges += tax_amount return custom_sales_taxes_and_charges + + +@frappe.whitelist() +def get_making_charge(item_code): + """ + Fetches the making_charge for a given item_code from the AuMMS Item doctype. + """ + if item_code: + + making_charge = frappe.db.get_value('AuMMS Item', {'item_code': item_code}, 'making_charge') + return making_charge if making_charge else 0 + return 0 + + + +# def before_save(self): +# self.update_making_charge() + +# def update_making_charge(self): +# try: +# for item in self.items: +# if item.item_code: +# item.making_charge = get_making_charge(item.item_code) +# except Exception as e: +# frappe.log_error("This error occured -> ",e) + +# def get_making_charge(item_code): +# """ +# Fetches the making_charge for a given item_code from the AuMMS Item doctype. +# """ +# if item_code: + +# making_charge = frappe.db.get_value('AuMMS Item', {'item_code': item_code}, 'making_charge') +# return making_charge if making_charge else 0 +# return 0 diff --git a/aumms/aumms/utils.py b/aumms/aumms/utils.py index e1b450f4..201ee6c0 100644 --- a/aumms/aumms/utils.py +++ b/aumms/aumms/utils.py @@ -1,6 +1,7 @@ import frappe from frappe.utils import * from frappe import _ +from frappe.utils import getdate @frappe.whitelist() def get_board_rate(item_type, purity, stock_uom, date, time=None): @@ -12,14 +13,19 @@ def get_board_rate(item_type, purity, stock_uom, date, time=None): else: filters = { 'docstatus': '1', 'item_type': item_type, 'purity': purity, 'date': getdate(date) } + print(filters) + if frappe.db.exists('Board Rate', filters): # get board rate and board rate uom (bruom) board_rate, bruom = frappe.db.get_value('Board Rate', filters, ['board_rate', 'uom']) + print("as", board_rate, bruom) # return board rate if board rate uom is same as stock uom if bruom == stock_uom: return board_rate # else multiply the board rate with conversion factor else: + if stock_uom == "Nos" or bruom == 'Gram' or bruom == 'Nos': + return board_rate # get conversion factor value using stock_uom as from_uom and bruom as to_uom conversion_factor = get_conversion_factor(stock_uom, bruom) if conversion_factor: From 0fd4cc40dac9b7c2446dc10db72cb6a5fde1bf77 Mon Sep 17 00:00:00 2001 From: ajmalroshan123 Date: Sat, 2 Nov 2024 11:14:38 +0530 Subject: [PATCH 03/15] fix: removed the customized field --- .../jewellery_invoice/jewellery_invoice.js | 8 +- .../jewellery_invoice/jewellery_invoice.json | 9 +- aumms/fixtures/custom_field.json | 600 ++++++++++-------- aumms/fixtures/designation.json | 4 +- aumms/fixtures/role.json | 70 +- aumms/fixtures/workflow_action_master.json | 7 + 6 files changed, 366 insertions(+), 332 deletions(-) diff --git a/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.js b/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.js index 7dc6e13d..70d62439 100644 --- a/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.js +++ b/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.js @@ -224,7 +224,7 @@ frappe.ui.form.on('Jewellery Invoice Item', { let stone_details = r.message.stone_details; $.each(stone_details, function(index, row) { - let child = frm.add_child('custom_stone_detail_'); + let child = frm.add_child('stone_details'); child.item_code = d.item_code; child.item_name = row.item_name; child.stone_type = row.stone_type; @@ -232,7 +232,7 @@ frappe.ui.form.on('Jewellery Invoice Item', { child.stone_charge = row.stone_charge; }); - frm.refresh_field('custom_stone_detail_'); + frm.refresh_field('stone_details'); } } }); @@ -849,11 +849,11 @@ function calculate_discount_and_total(frm, cdt, cdn) { frappe.model.set_value(cdt, cdn, 'custom_discount_final', discounted_amount); // Calculate and set the total discounted amount - let total = frm.doc.custom_stone_detail_.reduce((sum, r) => + let total = frm.doc.stone_details.reduce((sum, r) => sum + flt(r.stone_charge) * (1 - flt(r.discount) / 100), 0); frm.set_value('custom_discount_final', total); - frm.refresh_fields(['custom_stone_detail_', 'custom_discount_final']); + frm.refresh_fields(['stone_details', 'custom_discount_final']); } diff --git a/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.json b/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.json index ddb48659..dc542c80 100644 --- a/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.json +++ b/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.json @@ -20,6 +20,7 @@ "old_jewellery_items", "items_section", "items", + "stone_details", "section_break_ypbyf", "total_old_gold_weight", "total_gold_weight", @@ -400,13 +401,19 @@ "fieldtype": "Link", "label": "Sales Taxes and Charges Template", "options": "Sales Taxes and Charges Template" + }, + { + "fieldname": "stone_details", + "fieldtype": "Table", + "label": "Stone Details", + "options": "Stone Detals - 2" } ], "hide_toolbar": 1, "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], - "modified": "2024-02-03 11:58:01.263231", + "modified": "2024-11-02 10:57:46.369218", "modified_by": "Administrator", "module": "AuMMS", "name": "Jewellery Invoice", diff --git a/aumms/fixtures/custom_field.json b/aumms/fixtures/custom_field.json index 28e34817..a926017f 100644 --- a/aumms/fixtures/custom_field.json +++ b/aumms/fixtures/custom_field.json @@ -31,6 +31,7 @@ "is_virtual": 0, "label": "Is Purity UOM", "length": 0, + "link_filters": null, "mandatory_depends_on": null, "modified": "2023-01-05 10:33:35.446753", "module": null, @@ -39,6 +40,7 @@ "non_negative": 0, "options": null, "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, @@ -86,6 +88,7 @@ "is_virtual": 0, "label": "Total Taxes and Charges (Company Currency)", "length": 0, + "link_filters": null, "mandatory_depends_on": null, "modified": "2024-02-07 22:15:11.279549", "module": null, @@ -94,6 +97,7 @@ "non_negative": 0, "options": "Company:company:default_currency", "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 1, "print_hide_if_no_value": 0, @@ -141,6 +145,7 @@ "is_virtual": 0, "label": "Total Taxes and Charges", "length": 0, + "link_filters": null, "mandatory_depends_on": null, "modified": "2024-02-07 22:15:11.742343", "module": null, @@ -149,6 +154,7 @@ "non_negative": 0, "options": "currency", "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 1, "print_hide_if_no_value": 0, @@ -164,6 +170,177 @@ "unique": 0, "width": null }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": "eval:doc.is_purity_item", + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Item", + "fetch_from": "purity.purity_percentage", + "fetch_if_empty": 0, + "fieldname": "purity_percentage", + "fieldtype": "Percent", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "purity", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Purity Percentage", + "length": 0, + "link_filters": null, + "mandatory_depends_on": null, + "modified": "2023-01-06 14:48:46.579229", + "module": null, + "name": "Item-purity_percentage", + "no_copy": 0, + "non_negative": 0, + "options": null, + "permlevel": 0, + "placeholder": null, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 1, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": "0", + "depends_on": "has_stone", + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Item", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "stone_charge", + "fieldtype": "Currency", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "stone_weight", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Stone Charge", + "length": 0, + "link_filters": null, + "mandatory_depends_on": null, + "modified": "2023-08-10 16:22:43.694341", + "module": null, + "name": "Item-stone_charge", + "no_copy": 0, + "non_negative": 0, + "options": null, + "permlevel": 0, + "placeholder": null, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Item", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "custom_item_qr_code", + "fieldtype": "Image", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "item_qr", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Item QR Code", + "length": 0, + "link_filters": null, + "mandatory_depends_on": null, + "modified": "2024-02-15 12:27:24.365547", + "module": null, + "name": "Item-custom_item_qr_code", + "no_copy": 0, + "non_negative": 0, + "options": "item_qr", + "permlevel": 0, + "placeholder": null, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, { "allow_in_quick_entry": 0, "allow_on_submit": 0, @@ -196,6 +373,7 @@ "is_virtual": 0, "label": "Head of Department", "length": 0, + "link_filters": null, "mandatory_depends_on": null, "modified": "2023-10-20 15:16:08.680216", "module": null, @@ -204,6 +382,7 @@ "non_negative": 0, "options": "Employee", "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, @@ -251,6 +430,7 @@ "is_virtual": 0, "label": "Keep Metal Ledger", "length": 0, + "link_filters": null, "mandatory_depends_on": null, "modified": "2023-01-19 17:11:57.835012", "module": null, @@ -259,6 +439,7 @@ "non_negative": 0, "options": null, "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, @@ -306,6 +487,7 @@ "is_virtual": 0, "label": "Is AuMMS Item Group", "length": 0, + "link_filters": null, "mandatory_depends_on": null, "modified": "2023-08-10 16:44:07.982502", "module": null, @@ -314,6 +496,7 @@ "non_negative": 0, "options": null, "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, @@ -361,6 +544,7 @@ "is_virtual": 0, "label": "Assigned To", "length": 0, + "link_filters": null, "mandatory_depends_on": null, "modified": "2023-11-15 12:12:19.890413", "module": null, @@ -369,6 +553,7 @@ "non_negative": 0, "options": "Smith", "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, @@ -385,23 +570,23 @@ "width": null }, { - "allow_in_quick_entry": 1, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "collapsible_depends_on": null, "columns": 0, "default": null, - "depends_on": "", + "depends_on": null, "description": null, "docstatus": 0, "doctype": "Custom Field", - "dt": "Item", - "fetch_from": "item_group.item_type", - "fetch_if_empty": 1, - "fieldname": "item_type", + "dt": "Job Card", + "fetch_from": "assigned_to.employee", + "fetch_if_empty": 0, + "fieldname": "assigned_employee", "fieldtype": "Link", - "hidden": 0, + "hidden": 1, "hide_border": 0, "hide_days": 0, "hide_seconds": 0, @@ -411,24 +596,26 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "item_group", + "insert_after": "assigned_to", "is_system_generated": 0, "is_virtual": 0, - "label": "Item Type", + "label": "Assigned Employee", "length": 0, - "mandatory_depends_on": "", - "modified": "2023-01-06 16:49:20.501863", + "link_filters": null, + "mandatory_depends_on": null, + "modified": "2023-11-15 12:32:11.204644", "module": null, - "name": "Item-item_type", + "name": "Job Card-assigned_employee", "no_copy": 0, "non_negative": 0, - "options": "Item Type", + "options": "Employee", "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, "print_width": null, - "read_only": 0, + "read_only": 1, "read_only_depends_on": null, "report_hide": 0, "reqd": 0, @@ -440,23 +627,23 @@ "width": null }, { - "allow_in_quick_entry": 0, + "allow_in_quick_entry": 1, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "collapsible_depends_on": null, "columns": 0, "default": null, - "depends_on": null, + "depends_on": "", "description": null, "docstatus": 0, "doctype": "Custom Field", - "dt": "Job Card", - "fetch_from": "assigned_to.employee", - "fetch_if_empty": 0, - "fieldname": "assigned_employee", + "dt": "Item", + "fetch_from": "item_group.item_type", + "fetch_if_empty": 1, + "fieldname": "item_type", "fieldtype": "Link", - "hidden": 1, + "hidden": 0, "hide_border": 0, "hide_days": 0, "hide_seconds": 0, @@ -466,24 +653,26 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "assigned_to", + "insert_after": "item_group", "is_system_generated": 0, "is_virtual": 0, - "label": "Assigned Employee", + "label": "Item Type", "length": 0, - "mandatory_depends_on": null, - "modified": "2023-11-15 12:32:11.204644", + "link_filters": null, + "mandatory_depends_on": "", + "modified": "2023-01-06 16:49:20.501863", "module": null, - "name": "Job Card-assigned_employee", + "name": "Item-item_type", "no_copy": 0, "non_negative": 0, - "options": "Employee", + "options": "Item Type", "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, "print_width": null, - "read_only": 1, + "read_only": 0, "read_only_depends_on": null, "report_hide": 0, "reqd": 0, @@ -526,6 +715,7 @@ "is_virtual": 0, "label": "Item Type", "length": 0, + "link_filters": null, "mandatory_depends_on": null, "modified": "2023-01-05 15:09:57.352372", "module": null, @@ -534,6 +724,7 @@ "non_negative": 0, "options": "Item Type", "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, @@ -581,6 +772,7 @@ "is_virtual": 0, "label": "Party Link", "length": 0, + "link_filters": null, "mandatory_depends_on": null, "modified": "2023-01-27 16:49:36.956964", "module": null, @@ -589,6 +781,7 @@ "non_negative": 0, "options": "Party Link", "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, @@ -612,15 +805,15 @@ "collapsible_depends_on": null, "columns": 0, "default": null, - "depends_on": "eval:doc.is_purity_item", + "depends_on": null, "description": null, "docstatus": 0, "doctype": "Custom Field", - "dt": "Item", - "fetch_from": "item_group.making_charge_based_on", - "fetch_if_empty": 1, - "fieldname": "making_charge_based_on", - "fieldtype": "Select", + "dt": "Employee", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "custom_warehouse", + "fieldtype": "Link", "hidden": 0, "hide_border": 0, "hide_days": 0, @@ -631,19 +824,21 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "stock_uom", + "insert_after": "employee_name", "is_system_generated": 0, "is_virtual": 0, - "label": "Making Charge Based On", + "label": "Warehouse", "length": 0, + "link_filters": null, "mandatory_depends_on": null, - "modified": "2023-01-05 17:32:05.643181", + "modified": "2024-04-29 14:36:36.781226", "module": null, - "name": "Item-making_charge_based_on", + "name": "Employee-custom_warehouse", "no_copy": 0, "non_negative": 0, - "options": "\nFixed\nPercentage", + "options": "Warehouse", "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, @@ -655,7 +850,7 @@ "search_index": 0, "show_dashboard": 0, "sort_options": 0, - "translatable": 1, + "translatable": 0, "unique": 0, "width": null }, @@ -667,16 +862,16 @@ "collapsible_depends_on": null, "columns": 0, "default": null, - "depends_on": null, + "depends_on": "", "description": null, "docstatus": 0, "doctype": "Custom Field", - "dt": "Employee", - "fetch_from": null, + "dt": "Item Group", + "fetch_from": "item_type.is_purity_item", "fetch_if_empty": 0, - "fieldname": "custom_warehouse", - "fieldtype": "Link", - "hidden": 0, + "fieldname": "is_purity_item", + "fieldtype": "Check", + "hidden": 1, "hide_border": 0, "hide_days": 0, "hide_seconds": 0, @@ -686,24 +881,26 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "employee_name", + "insert_after": "item_type", "is_system_generated": 0, "is_virtual": 0, - "label": "Warehouse", + "label": "Is Purity Item", "length": 0, + "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-04-29 14:36:36.781226", + "modified": "2023-01-31 12:41:20.505617", "module": null, - "name": "Employee-custom_warehouse", + "name": "Item Group-is_purity_item", "no_copy": 0, "non_negative": 0, - "options": "Warehouse", + "options": null, "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, "print_width": null, - "read_only": 0, + "read_only": 1, "read_only_depends_on": null, "report_hide": 0, "reqd": 0, @@ -722,16 +919,16 @@ "collapsible_depends_on": null, "columns": 0, "default": null, - "depends_on": "", + "depends_on": "eval:doc.is_purity_item", "description": null, "docstatus": 0, "doctype": "Custom Field", - "dt": "Item Group", - "fetch_from": "item_type.is_purity_item", - "fetch_if_empty": 0, - "fieldname": "is_purity_item", - "fieldtype": "Check", - "hidden": 1, + "dt": "Item", + "fetch_from": "item_group.making_charge_based_on", + "fetch_if_empty": 1, + "fieldname": "making_charge_based_on", + "fieldtype": "Select", + "hidden": 0, "hide_border": 0, "hide_days": 0, "hide_seconds": 0, @@ -741,31 +938,33 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "item_type", + "insert_after": "stock_uom", "is_system_generated": 0, "is_virtual": 0, - "label": "Is Purity Item", + "label": "Making Charge Based On", "length": 0, + "link_filters": null, "mandatory_depends_on": null, - "modified": "2023-01-31 12:41:20.505617", + "modified": "2023-01-05 17:32:05.643181", "module": null, - "name": "Item Group-is_purity_item", + "name": "Item-making_charge_based_on", "no_copy": 0, "non_negative": 0, - "options": null, + "options": "\nFixed\nPercentage", "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, "print_width": null, - "read_only": 1, + "read_only": 0, "read_only_depends_on": null, "report_hide": 0, "reqd": 0, "search_index": 0, "show_dashboard": 0, "sort_options": 0, - "translatable": 0, + "translatable": 1, "unique": 0, "width": null }, @@ -801,6 +1000,7 @@ "is_virtual": 0, "label": "Making Charge Based On", "length": 0, + "link_filters": null, "mandatory_depends_on": null, "modified": "2023-01-05 10:54:18.536026", "module": null, @@ -809,6 +1009,7 @@ "non_negative": 0, "options": "\nFixed\nPercentage", "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, @@ -856,6 +1057,7 @@ "is_virtual": 0, "label": "Making Charge Percentage", "length": 0, + "link_filters": null, "mandatory_depends_on": "eval: doc.making_charge_based_on == 'Percentage'", "modified": "2023-01-05 15:09:29.804481", "module": null, @@ -864,6 +1066,7 @@ "non_negative": 0, "options": null, "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, @@ -911,6 +1114,7 @@ "is_virtual": 0, "label": "Percentage", "length": 0, + "link_filters": null, "mandatory_depends_on": "eval: doc.making_charge_based_on == 'Percentage'", "modified": "2023-01-05 11:41:02.132844", "module": null, @@ -919,6 +1123,7 @@ "non_negative": 0, "options": null, "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, @@ -966,6 +1171,7 @@ "is_virtual": 0, "label": "Making Charge", "length": 0, + "link_filters": null, "mandatory_depends_on": "eval: doc.making_charge_based_on == 'Fixed'", "modified": "2023-01-06 11:28:22.995811", "module": null, @@ -974,6 +1180,7 @@ "non_negative": 0, "options": null, "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, @@ -1021,6 +1228,7 @@ "is_virtual": 0, "label": "Currency", "length": 0, + "link_filters": null, "mandatory_depends_on": "eval: doc.making_charge_based_on == 'Fixed'", "modified": "2023-01-05 12:43:08.976116", "module": null, @@ -1029,6 +1237,7 @@ "non_negative": 0, "options": null, "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, @@ -1076,6 +1285,7 @@ "is_virtual": 0, "label": "Is Sales Item", "length": 0, + "link_filters": null, "mandatory_depends_on": null, "modified": "2023-01-11 15:57:23.780415", "module": null, @@ -1084,6 +1294,7 @@ "non_negative": 0, "options": null, "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, @@ -1131,6 +1342,7 @@ "is_virtual": 0, "label": "Keep Metal Ledger", "length": 0, + "link_filters": null, "mandatory_depends_on": null, "modified": "2023-01-19 16:51:12.721967", "module": null, @@ -1139,6 +1351,7 @@ "non_negative": 0, "options": null, "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, @@ -1186,6 +1399,7 @@ "is_virtual": 0, "label": "Is Purchase Item", "length": 0, + "link_filters": null, "mandatory_depends_on": null, "modified": "2023-01-11 15:57:25.254765", "module": null, @@ -1194,6 +1408,7 @@ "non_negative": 0, "options": null, "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, @@ -1217,16 +1432,16 @@ "collapsible_depends_on": null, "columns": 0, "default": null, - "depends_on": "eval:doc.is_purity_item", + "depends_on": null, "description": null, "docstatus": 0, "doctype": "Custom Field", - "dt": "Item", - "fetch_from": "purity.purity_percentage", + "dt": "Purchase Receipt", + "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "purity_percentage", - "fieldtype": "Percent", - "hidden": 0, + "fieldname": "create_invoice_on_submit", + "fieldtype": "Check", + "hidden": 1, "hide_border": 0, "hide_days": 0, "hide_seconds": 0, @@ -1236,19 +1451,21 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "purity", + "insert_after": "keep_metal_ledger", "is_system_generated": 0, "is_virtual": 0, - "label": "Purity Percentage", + "label": "Create Invoice on Submit", "length": 0, + "link_filters": null, "mandatory_depends_on": null, - "modified": "2023-01-06 14:48:46.579229", + "modified": "2023-08-23 15:44:29.173542", "module": null, - "name": "Item-purity_percentage", + "name": "Purchase Receipt-create_invoice_on_submit", "no_copy": 0, "non_negative": 0, "options": null, "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, @@ -1276,12 +1493,12 @@ "description": null, "docstatus": 0, "doctype": "Custom Field", - "dt": "Purchase Receipt", + "dt": "Item", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "create_invoice_on_submit", + "fieldname": "is_aumms_item", "fieldtype": "Check", - "hidden": 1, + "hidden": 0, "hide_border": 0, "hide_days": 0, "hide_seconds": 0, @@ -1291,19 +1508,21 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "keep_metal_ledger", + "insert_after": "disabled", "is_system_generated": 0, "is_virtual": 0, - "label": "Create Invoice on Submit", + "label": "Is AuMMS Item", "length": 0, + "link_filters": null, "mandatory_depends_on": null, - "modified": "2023-08-23 15:44:29.173542", + "modified": "2023-08-10 16:32:46.294462", "module": null, - "name": "Purchase Receipt-create_invoice_on_submit", + "name": "Item-is_aumms_item", "no_copy": 0, "non_negative": 0, "options": null, "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, @@ -1351,6 +1570,7 @@ "is_virtual": 0, "label": "Assigned To", "length": 0, + "link_filters": null, "mandatory_depends_on": null, "modified": "2023-11-14 12:22:34.239256", "module": null, @@ -1359,6 +1579,7 @@ "non_negative": 0, "options": "Smith", "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, @@ -1406,6 +1627,7 @@ "is_virtual": 0, "label": "Item Type", "length": 0, + "link_filters": null, "mandatory_depends_on": null, "modified": "2023-01-11 12:31:08.595209", "module": null, @@ -1414,61 +1636,7 @@ "non_negative": 0, "options": "Item Type", "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Work Order", - "fetch_from": "assigned_to.smith_name", - "fetch_if_empty": 1, - "fieldname": "smith_name", - "fieldtype": "Data", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "assigned_to", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Smith Name", - "length": 0, - "mandatory_depends_on": null, - "modified": "2023-11-14 12:48:04.270472", - "module": null, - "name": "Work Order-smith_name", - "no_copy": 0, - "non_negative": 0, - "options": null, - "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, @@ -1499,7 +1667,7 @@ "dt": "Item", "fetch_from": null, "fetch_if_empty": 0, - "fieldname": "is_aumms_item", + "fieldname": "custom_is_raw_material", "fieldtype": "Check", "hidden": 0, "hide_border": 0, @@ -1511,24 +1679,26 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "disabled", + "insert_after": "is_aumms_item", "is_system_generated": 0, "is_virtual": 0, - "label": "Is AuMMS Item", + "label": "Is Raw Material", "length": 0, + "link_filters": null, "mandatory_depends_on": null, - "modified": "2023-08-10 16:32:46.294462", + "modified": "2024-03-20 12:16:05.286660", "module": null, - "name": "Item-is_aumms_item", + "name": "Item-custom_is_raw_material", "no_copy": 0, "non_negative": 0, "options": null, "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, "print_width": null, - "read_only": 1, + "read_only": 0, "read_only_depends_on": null, "report_hide": 0, "reqd": 0, @@ -1551,11 +1721,11 @@ "description": null, "docstatus": 0, "doctype": "Custom Field", - "dt": "Item", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "custom_is_raw_material", - "fieldtype": "Check", + "dt": "Work Order", + "fetch_from": "assigned_to.smith_name", + "fetch_if_empty": 1, + "fieldname": "smith_name", + "fieldtype": "Data", "hidden": 0, "hide_border": 0, "hide_days": 0, @@ -1566,19 +1736,21 @@ "in_list_view": 0, "in_preview": 0, "in_standard_filter": 0, - "insert_after": "is_aumms_item", + "insert_after": "assigned_to", "is_system_generated": 0, "is_virtual": 0, - "label": "Is Raw Material", + "label": "Smith Name", "length": 0, + "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-03-20 12:16:05.286660", + "modified": "2023-11-14 12:48:04.270472", "module": null, - "name": "Item-custom_is_raw_material", + "name": "Work Order-smith_name", "no_copy": 0, "non_negative": 0, "options": null, "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, @@ -1626,6 +1798,7 @@ "is_virtual": 0, "label": "Keep Metal Ledger", "length": 0, + "link_filters": null, "mandatory_depends_on": null, "modified": "2023-08-23 15:14:10.150999", "module": null, @@ -1634,6 +1807,7 @@ "non_negative": 0, "options": null, "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, @@ -1681,6 +1855,7 @@ "is_virtual": 0, "label": "Taxes and Charges", "length": 0, + "link_filters": null, "mandatory_depends_on": null, "modified": "2024-02-07 22:15:10.690293", "module": null, @@ -1689,6 +1864,7 @@ "non_negative": 0, "options": null, "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, @@ -1736,6 +1912,7 @@ "is_virtual": 0, "label": "Keep Metal Ledger", "length": 0, + "link_filters": null, "mandatory_depends_on": null, "modified": "2023-01-19 15:29:50.710586", "module": null, @@ -1744,6 +1921,7 @@ "non_negative": 0, "options": null, "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, @@ -1791,6 +1969,7 @@ "is_virtual": 0, "label": "Sales Taxes and Charges", "length": 0, + "link_filters": null, "mandatory_depends_on": null, "modified": "2024-02-07 22:15:11.034978", "module": null, @@ -1799,61 +1978,7 @@ "non_negative": 0, "options": "Sales Taxes and Charges", "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Item", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "custom_item_qr_code", - "fieldtype": "Image", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "item_qr", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Item QR Code", - "length": 0, - "mandatory_depends_on": null, - "modified": "2024-02-15 12:27:24.365547", - "module": null, - "name": "Item-custom_item_qr_code", - "no_copy": 0, - "non_negative": 0, - "options": "item_qr", - "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, @@ -1901,6 +2026,7 @@ "is_virtual": 0, "label": "Gold Weight", "length": 0, + "link_filters": null, "mandatory_depends_on": "", "modified": "2023-08-10 16:25:51.557590", "module": null, @@ -1909,6 +2035,7 @@ "non_negative": 0, "options": null, "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, @@ -1956,6 +2083,7 @@ "is_virtual": 0, "label": "Has Stone", "length": 0, + "link_filters": null, "mandatory_depends_on": null, "modified": "2023-08-10 16:19:51.484765", "module": null, @@ -1964,61 +2092,7 @@ "non_negative": 0, "options": null, "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": "0", - "depends_on": "has_stone", - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Item", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "stone_charge", - "fieldtype": "Currency", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "stone_weight", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Stone Charge", - "length": 0, - "mandatory_depends_on": null, - "modified": "2023-08-10 16:22:43.694341", - "module": null, - "name": "Item-stone_charge", - "no_copy": 0, - "non_negative": 0, - "options": null, - "permlevel": 0, + "placeholder": null, "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, diff --git a/aumms/fixtures/designation.json b/aumms/fixtures/designation.json index 532921ca..bf7acce2 100644 --- a/aumms/fixtures/designation.json +++ b/aumms/fixtures/designation.json @@ -1,10 +1,12 @@ [ { + "appraisal_template": null, "description": null, "designation_name": "Smith", "docstatus": 0, "doctype": "Designation", "modified": "2023-11-09 16:31:17.044970", - "name": "Smith" + "name": "Smith", + "skills": [] } ] \ No newline at end of file diff --git a/aumms/fixtures/role.json b/aumms/fixtures/role.json index a3be40d6..dd56b48a 100644 --- a/aumms/fixtures/role.json +++ b/aumms/fixtures/role.json @@ -1,149 +1,93 @@ [ { - "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-07 11:57:06.425584", "name": "Sales Manager", - "notifications": 1, "restrict_to_domain": null, "role_name": "Sales Manager", - "search_bar": 1, - "timeline": 1, - "two_factor_auth": 0, - "view_switcher": 1 + "two_factor_auth": 0 }, { - "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 + "two_factor_auth": 0 }, { - "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": "2023-08-09 11:52:51.350016", "name": "Supervisor", - "notifications": 1, "restrict_to_domain": null, "role_name": "Supervisor", - "search_bar": 1, - "timeline": 1, - "two_factor_auth": 0, - "view_switcher": 1 + "two_factor_auth": 0 }, { - "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": "2023-08-09 12:56:39.398103", "name": "Design Analyst", - "notifications": 1, "restrict_to_domain": null, "role_name": "Design Analyst", - "search_bar": 1, - "timeline": 1, - "two_factor_auth": 0, - "view_switcher": 1 + "two_factor_auth": 0 }, { - "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": "2023-10-18 15:34:02.128307", "name": "Head of Smith", - "notifications": 1, "restrict_to_domain": null, "role_name": "Head of Smith", - "search_bar": 1, - "timeline": 1, - "two_factor_auth": 0, - "view_switcher": 1 + "two_factor_auth": 0 }, { - "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": "2023-10-18 16:03:05.894641", "name": "Smith", - "notifications": 1, "restrict_to_domain": null, "role_name": "Smith", - "search_bar": 1, - "timeline": 1, - "two_factor_auth": 0, - "view_switcher": 1 + "two_factor_auth": 0 }, { - "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-02-01 12:22:37.829708", "name": "AuMMS Manager", - "notifications": 1, "restrict_to_domain": null, "role_name": "AuMMS Manager", - "search_bar": 1, - "timeline": 1, - "two_factor_auth": 0, - "view_switcher": 1 + "two_factor_auth": 0 } ] \ No newline at end of file diff --git a/aumms/fixtures/workflow_action_master.json b/aumms/fixtures/workflow_action_master.json index bcec71f3..6a8ba254 100644 --- a/aumms/fixtures/workflow_action_master.json +++ b/aumms/fixtures/workflow_action_master.json @@ -1,4 +1,11 @@ [ + { + "docstatus": 0, + "doctype": "Workflow Action Master", + "modified": "2024-10-21 16:21:30.096728", + "name": "Review", + "workflow_action_name": "Review" + }, { "docstatus": 0, "doctype": "Workflow Action Master", From 25d2c7f14a02393dd4d59c002f032756970ab26f Mon Sep 17 00:00:00 2001 From: ajmalroshan123 Date: Mon, 4 Nov 2024 17:28:23 +0530 Subject: [PATCH 04/15] feat: Added Discount fetching Pricing Rule --- .../jewellery_invoice/jewellery_invoice.js | 337 +++++++----------- .../jewellery_invoice/jewellery_invoice.py | 48 +-- 2 files changed, 166 insertions(+), 219 deletions(-) diff --git a/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.js b/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.js index 70d62439..bcafe0c3 100644 --- a/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.js +++ b/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.js @@ -32,22 +32,7 @@ frappe.ui.form.on('Jewellery Invoice', { }) } }, - // validate: function(frm){ - // set_totals(frm); - // }, - - // edit by aj - - // disable_rounded_total: function(frm){ - // if(frm.doc.disable_rounded_total){ - // frm.set_value('rounding_adjustment', 0); - // } - // else{ - // frm.set_value('rounded_total', Math.round(frm.doc.grand_total)); - // frm.set_value('rounding_adjustment', frm.doc.rounded_total - frm.doc.grand_total); - // } - // frm.set_value('rounded_total', frm.doc.grand_total+frm.doc.rounding_adjustment); - // }, + delivery_date: function(frm){ if(frm.doc.delivery_date){ set_missing_delivery_dates(frm); @@ -99,7 +84,6 @@ frappe.ui.form.on('Jewellery Invoice', { } }); -// edited by aj frappe.ui.form.on('Old Jewellery Item', { item_code: function(frm, cdt, cdn) { let d = locals[cdt][cdn]; @@ -157,112 +141,8 @@ frappe.ui.form.on('Old Jewellery Item', { } }); -// aj frappe.ui.form.on('Jewellery Invoice Item', { -// item_code: function(frm, cdt, cdn){ -// console.log("here-1"); -// let d = locals[cdt][cdn]; -// if (d.item_code){ -// if(frm.doc.delivery_date){ -// frappe.model.set_value(d.doctype, d.name, 'delivery_date', frm.doc.delivery_date); -// } -// if (d.is_purity_item){ -// frappe.call({ -// // Method for fetching gold_weight, making_charge_percentage, making_charge & board_rate -// method: 'aumms.aumms.doc_events.sales_order.get_item_details', -// args: { -// 'item_code': d.item_code, -// 'item_type': d.item_type, -// 'date': frm.doc.transaction_date, -// 'purity': d.purity, -// 'stock_uom': d.stock_uom -// }, -// callback: function(r) { -// if (r.message){ -// frappe.model.set_value(d.doctype, d.name, 'gold_weight', r.message['gold_weight']); -// frappe.model.set_value(d.doctype, d.name, 'stone_weight', r.message['stone_weight']); -// frappe.model.set_value(d.doctype, d.name, 'net_weight', r.message['net_weight']); -// frappe.model.set_value(d.doctype, d.name, 'stone_charge', r.message['stone_charge']); -// frappe.model.set_value(d.doctype, d.name, 'making_charge_percentage', r.message['making_charge_percentage']); -// frappe.model.set_value(d.doctype, d.name, 'is_fixed_making_charge', r.message['making_charge']); -// frappe.model.set_value(d.doctype, d.name, 'board_rate', r.message['board_rate']); -// frappe.model.set_value(d.doctype, d.name, 'making_charge_based_on', r.message['making_charge_based_on']); -// frappe.model.set_value(d.doctype, d.name, 'making_charge_percentage', r.message['making_charge_percentage']); -// frappe.model.set_value(d.doctype, d.name, 'amount_with_out_making_charge', r.message['gold_weight'] * r.message['board_rate']); -// frappe.model.set_value(d.doctype, d.name, 'net_amount_with_out_making_charge', (r.message['gold_weight'] * r.message['board_rate']) + r.message['stone_charge']); -// if (r.message['making_charge']){ -// frappe.model.set_value(d.doctype, d.name, 'making_charge', r.message['making_charge']); -// } -// else { -// //set making_charge if it's percentage -// frappe.model.set_value(d.doctype, d.name, 'making_charge', (d.amount_with_out_making_charge)*(d.making_charge_percentage * 0.01)); -// } -// frappe.model.set_value(d.doctype, d.name, 'rate', (d.net_amount_with_out_making_charge + d.making_charge)/d.gold_weight); -// frm.refresh_field('items'); -// } -// } -// }) -// } -// } - - - // code to fetch stone details aj -// }, - item_code: function(frm, cdt, cdn) { - let d = locals[cdt][cdn]; - - if (d.item_code) { - frappe.call({ - method: "frappe.client.get", - args: { - doctype: "AuMMS Item", - name: d.item_code - }, - callback: function(r) { - if (r.message) { - let stone_details = r.message.stone_details; - - $.each(stone_details, function(index, row) { - let child = frm.add_child('stone_details'); - child.item_code = d.item_code; - child.item_name = row.item_name; - child.stone_type = row.stone_type; - child.stone_weight = row.stone_weight; - child.stone_charge = row.stone_charge; - }); - - frm.refresh_field('stone_details'); - } - } - }); - } -}, - // item_code: function(frm, cdt, cdn) { - // let d = locals[cdt][cdn]; - - // if (d.item_code) { - // frappe.db.get_list('Stone Details', { - // fields: ['item_name', 'stone_type', 'stone_weight', 'stone_charge'], - // filters: { - // parent: d.item_code - // } - // }).then(records => { - - // records.forEach(record => { - - // let child = frm.add_child('custom_stone_detail_'); - // child.item_name = record.item_name; - // child.stone_type = record.stone_type; - // child.stone_weight = record.stone_weight; - // child.stone_charge = record.stone_charge; - // }); - - // frm.refresh_field('custom_stone_detail_'); - // }); - // } - - gold_weight: function(frm, cdt, cdn){ let d = locals[cdt][cdn]; @@ -443,19 +323,6 @@ let set_filters = function(frm){ }); } -// let set_totals = function(frm){ -// let total = 0; -// if(frm.doc.items){ -// frm.doc.items.forEach((child) => { -// if(child.amount){ -// total = total + child.amount; -// } -// }); -// } -// frm.set_value('grand_total', total); -// frm.set_value('rounded_total', total); -// frm.refresh_fields(); -// } let set_net_weight_and_amount = function(frm) { let total_old_gold_weight = 0; @@ -499,41 +366,6 @@ let set_net_weight_and_amount = function(frm) { } -// let set_net_weight_and_amount = function(frm){ -// let total_old_gold_weight = 0; -// let total_gold_weight = 0; -// let total_old_gold_amount = 0; -// let total_gold_amount = 0; -// let balance_amount = 0; -// if(frm.doc.items){ -// frm.doc.items.forEach((child) => { -// if(child.gold_weight){ -// total_gold_weight = total_gold_weight + child.gold_weight; -// } -// if(child.amount){ -// total_gold_amount = total_gold_amount + child.amount; -// } -// }); -// } -// if(frm.doc.transaction_type!='Sales' && frm.doc.old_jewellery_items){ -// frm.doc.old_jewellery_items.forEach((child) => { -// if(child.weight){ -// total_old_gold_weight = total_old_gold_weight + child.weight; -// } -// if(child.amount){ -// total_old_gold_amount = total_old_gold_amount + child.amount; -// } -// }); -// } -// balance_amount = total_gold_amount - total_old_gold_amount -// frm.set_value('total_gold_weight', total_gold_weight); -// frm.set_value('total_gold_amount', total_gold_amount); -// frm.set_value('total_old_gold_weight', total_old_gold_weight); -// frm.set_value('total_old_gold_amount', total_old_gold_amount); -// frm.set_value('balance_amount', balance_amount); -// frm.refresh_fields(); -// } - let set_missing_delivery_dates = function(frm){ if(frm.doc.items){ frm.doc.items.forEach((child) => { @@ -564,13 +396,6 @@ let create_custom_buttons = function(frm){ }); }, 'Create'); } - // if (frm.doc.sales_invoice && !frm.doc.metal_ledger_entry){ - // frappe.call('aumms.aumms.aumms.utils.create_metal_ledger_entries', { - // doc : frm.doc.sales_invoice - // }).then(r => { - // frm.reload_doc(); - // }); - // } if(frm.doc.sales_invoice && !frm.doc.delivery_note && !frm.doc.delivered){ frm.add_custom_button('Delivery Note', () => { @@ -735,7 +560,7 @@ let get_customer_advances= function(frm){ -// code to fetch the Item details by aj +// code to fetch the Item details frappe.ui.form.on('Jewellery Invoice Item', { item_code: function(frm, cdt, cdn) { @@ -813,26 +638,6 @@ frappe.ui.form.on('Jewellery Invoice Item', { } }); -//fetching making_charge -function fetch_and_set_making_charge(frm, d) { - frappe.call({ - method: "aumms.aumms.doctype.jewellery_invoice.jewellery_invoice.get_making_charge", - args: { - item_code: d.item_code - }, - callback: function(r) { - if (r.message) { - frappe.model.set_value(d.doctype, d.name, 'making_charge', r.message); - console.log(r.message, 'Fetched making_charge'); - - } - frm.refresh_field('items'); - } - }); -}; - - -// code by aj // discount frappe.ui.form.on('Stone Detals - 2', { @@ -857,7 +662,7 @@ function calculate_discount_and_total(frm, cdt, cdn) { } -// code to set Grand Total by aj +// code to set Grand Total frappe.ui.form.on('Jewellery Invoice', { items: { @@ -876,13 +681,147 @@ function calculate_total(frm) { let total_amount = 0; let discount = frm.doc.custom_discount_final || 0; - // Sum up for all items in the table frm.doc.items.forEach(function(item) { total_amount += (item.board_rate || 0) * (item.gold_weight || 0) + (item.making_charge || 0); }); + console.log(total_amount); + frm.set_value('grand_total', total_amount + discount); frm.set_value('rounded_total', grand_total) } + + +// code for stone details and discount +frappe.ui.form.on('Jewellery Invoice Item', { + item_code: function(frm, cdt, cdn) { + let row = locals[cdt][cdn]; + if (!row.item_code) return; + + fetch_and_add_stone_details(frm, row); + } +}); + +// Fetch stone details from AuMMS Item +function fetch_and_add_stone_details(frm, row) { + frappe.call({ + method: "frappe.client.get", + args: { + doctype: "AuMMS Item", + name: row.item_code + }, + callback: function(r) { + if (!r.message) { + frappe.msgprint('No item details found'); + return; + } + + let stone_details = r.message.stone_details || []; + add_stone_details_to_table(frm, row.item_code, stone_details); + + if (frm.doc.customer) { + apply_pricing_rules(frm); + } + } + }); +} + +// Add stone details to child table +function add_stone_details_to_table(frm, item_code, stone_details) { + + stone_details.forEach(function(row) { + let child = frm.add_child('stone_details'); + child.item_code = item_code; + child.item_name = row.item_name; + child.stone_type = row.stone_type; + child.stone_weight = row.stone_weight; + child.stone_charge = row.stone_charge; + }); + + frm.refresh_field('stone_details'); +} + +// Apply pricing rules based on customer +function apply_pricing_rules(frm) { + frappe.call({ + method: "aumms.aumms.doctype.jewellery_invoice.jewellery_invoice.get_pricing_rule_and_items", + args: { + customer: frm.doc.customer + }, + callback: function(r) { + if (!r.message) return; + + let discount_percentage = r.message.discount_percentage; + let rule_items = r.message.rule_items || []; + + update_stone_discounts(frm, discount_percentage, rule_items); + } + }); +} + +// Update discounts for matching stones +function update_stone_discounts(frm, discount_percentage, rule_items) { + frm.doc.stone_details.forEach(function(stone) { + let matched_item = rule_items.find(function(item) { + return item.item_code === stone.item_name; + }); + + if (matched_item) { + frappe.model.set_value( + stone.doctype, + stone.name, + 'discount', + discount_percentage + ); + } + }); + + frm.refresh_field('stone_details'); +} + + + + + +// fetch making charge +frappe.ui.form.on('Jewellery Invoice Item', { + item_code: function(frm, cdt, cdn) { + let row = locals[cdt][cdn]; + if (!row.item_code) { + frappe.msgprint('Please select an Item Code'); + return; + } + + fetch_and_set_making_charge(frm, row); + } +}); + +function fetch_and_set_making_charge(frm, row) { + frappe.call({ + method: "aumms.aumms.doctype.jewellery_invoice.jewellery_invoice.get_making_charge", + args: { + item_code: row.item_code + }, + callback: function(r) { + if (!r.message) { + return; + } + + update_making_charge(frm, row, r.message); + }, + }); +} + +// Update the making charge in the row +function update_making_charge(frm, row, making_charge) { + frappe.model.set_value( + row.doctype, + row.name, + 'making_charge', + making_charge + ); + + frm.refresh_field('items'); +} \ No newline at end of file diff --git a/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.py b/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.py index 409c743e..f58cbcc5 100644 --- a/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.py +++ b/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.py @@ -516,23 +516,31 @@ def get_making_charge(item_code): -# def before_save(self): -# self.update_making_charge() - -# def update_making_charge(self): -# try: -# for item in self.items: -# if item.item_code: -# item.making_charge = get_making_charge(item.item_code) -# except Exception as e: -# frappe.log_error("This error occured -> ",e) - -# def get_making_charge(item_code): -# """ -# Fetches the making_charge for a given item_code from the AuMMS Item doctype. -# """ -# if item_code: - -# making_charge = frappe.db.get_value('AuMMS Item', {'item_code': item_code}, 'making_charge') -# return making_charge if making_charge else 0 -# return 0 +@frappe.whitelist() +def get_pricing_rule_and_items(customer): + """Fetches the discount percentage and items from Pricing Rule Doctype based on Customer""" + + pricing_rule = frappe.db.get_list( + "Pricing Rule", + filters={"customer": customer, "disable": 0}, + fields=["name", "discount_percentage"], + limit=1 + ) + + if pricing_rule: + pricing_rule_name = pricing_rule[0].name + discount_percentage = pricing_rule[0].discount_percentage + + rule_items = frappe.get_all( + "Pricing Rule Item Code", + filters={"parent": pricing_rule_name}, + fields=["item_code"] + ) + + # Return the discount percentage and the list of item codes + return { + "discount_percentage": discount_percentage, + "rule_items": rule_items + } + + return {} From b0524738c3372266d3fb7a967b2ffe01a49ac4e1 Mon Sep 17 00:00:00 2001 From: ajmalroshan123 Date: Tue, 5 Nov 2024 17:17:20 +0530 Subject: [PATCH 05/15] feat: Implemented the board rate adjustment and identifying entry type of metal ledger --- .../aumms/doc_events/stock_reconciliation.py | 4 +- aumms/aumms/doctype/aumms_item/aumms_item.js | 59 ++++++++++++++ .../aumms/doctype/aumms_item/aumms_item.json | 10 +-- aumms/aumms/doctype/aumms_item/aumms_item.py | 80 ++++++++++--------- aumms/hooks.py | 6 +- aumms/setup.py | 43 ++++++++++ 6 files changed, 153 insertions(+), 49 deletions(-) diff --git a/aumms/aumms/doc_events/stock_reconciliation.py b/aumms/aumms/doc_events/stock_reconciliation.py index eafa2870..bea9749b 100644 --- a/aumms/aumms/doc_events/stock_reconciliation.py +++ b/aumms/aumms/doc_events/stock_reconciliation.py @@ -38,13 +38,15 @@ def insert_metal_ledger_entry( ), "amount": item.amount if not is_reversal else -item.amount, "incoming_rate" if not is_reversal else "outgoing_rate": item.valuation_rate, + "entry_type": "Opening Stock" if doc.purpose == 'Opening Stock' else None } + frappe.get_doc(fields).insert(ignore_permissions=1) def process_metal_ledger(doc, is_reversal=False): - if not doc.custom_keep_metal_ledger: + if not doc.keep_metal_ledger: return ledger_created = False diff --git a/aumms/aumms/doctype/aumms_item/aumms_item.js b/aumms/aumms/doctype/aumms_item/aumms_item.js index 3aa62083..7f623171 100644 --- a/aumms/aumms/doctype/aumms_item/aumms_item.js +++ b/aumms/aumms/doctype/aumms_item/aumms_item.js @@ -237,3 +237,62 @@ let calculate_stone_weight_and_charge = function(frm){ frm.set_value('stone_weight', stone_weight); frm.set_value('stone_charge', stone_charge); } + + +// Button to create Stock reconciliation +/////// + +frappe.ui.form.on('AuMMS Item', { + refresh: function(frm) { + frm.page.set_primary_action(__('Create'), function() { + // Remove any existing "Create Opening Stock" button + frm.remove_custom_button('Create Opening Stock'); + + // Add "Create Opening Stock" button + frm.add_custom_button(__('Create Opening Stock'), function() { + // Open a dialog to select the Board Rate + let dialog = new frappe.ui.Dialog({ + title: __('Select Board Rate'), + fields: [ + { + label: __('Board Rate'), + fieldname: 'board_rate', + fieldtype: 'Link', + options: 'Board Rate', + reqd: true + } + ], + primary_action_label: __('Create Opening Stock'), + primary_action: function(data) { + dialog.hide(); // Hide dialog after selection + + // Call the server-side function to create the opening stock + frappe.call({ + method: 'aumms.aumms.doctype.aumms_item.aumms_item.create_opening_stock', + args: { + item_list: frm.doc.name, + board_rate: data.board_rate + }, + freeze: true, + freeze_message: __('Creating Opening Stock...'), + callback: function(r) { + if (!r.exc) { + frappe.msgprint({ + title: __('Success'), + message: __('Opening Stock Created Successfully: {1}', + [r.message, r.message]), + indicator: 'green' + }); + frm.reload_doc(); + } + } + }); + } + }); + + dialog.show(); + }); + }); + + } +}); diff --git a/aumms/aumms/doctype/aumms_item/aumms_item.json b/aumms/aumms/doctype/aumms_item/aumms_item.json index 6bade1e0..bf29a04b 100644 --- a/aumms/aumms/doctype/aumms_item/aumms_item.json +++ b/aumms/aumms/doctype/aumms_item/aumms_item.json @@ -18,7 +18,6 @@ "column_break_36khf", "disabled", "is_stock_item", - "create_opening_stock", "is_stone_item", "is_raw_material", "stone_type", @@ -366,18 +365,11 @@ "fieldname": "is_raw_material", "fieldtype": "Check", "label": "Is Raw Material" - }, - { - "default": "0", - "depends_on": "eval: doc.is_stock_item", - "fieldname": "create_opening_stock", - "fieldtype": "Check", - "label": "Create Opening Stock" } ], "index_web_pages_for_search": 1, "links": [], - "modified": "2024-09-13 14:44:46.727296", + "modified": "2024-11-05 12:06:59.188117", "modified_by": "Administrator", "module": "AuMMS", "name": "AuMMS Item", diff --git a/aumms/aumms/doctype/aumms_item/aumms_item.py b/aumms/aumms/doctype/aumms_item/aumms_item.py index ea4a24c9..747cf9c6 100644 --- a/aumms/aumms/doctype/aumms_item/aumms_item.py +++ b/aumms/aumms/doctype/aumms_item/aumms_item.py @@ -63,8 +63,8 @@ def validate_gold_weight(self): def after_insert(self): """Method to create Item from AuMMS Item""" self.create_or_update_item() - if self.create_opening_stock: - create_opening_stock([self.name]) + # if self.create_opening_stock: + # create_opening_stock([self.name]) def on_update(self): """Method to update created Item on changes of AuMMS Item""" @@ -173,44 +173,48 @@ def create_opening_stock_from_list(item_list_json): - -def create_opening_stock(item_list): +@frappe.whitelist() +def create_opening_stock(item_list, board_rate=None): + # Retrieve the first available Warehouse and Account warehouse = frappe.db.exists("Warehouse", {"name": ["like", "%Stores%"]}) account = frappe.db.exists("Account", {"name": ["like", "%Temporary Opening%"]}) - - current_date = getdate() + if not warehouse or not account: + frappe.throw("Required Warehouse or Account not found.") - for item_name in item_list: - - aumms_item = frappe.get_doc("AuMMS Item", item_name) - - board_rate = frappe.db.get_value('Board Rate', - { - 'item_type': aumms_item.item_type, - 'purity': aumms_item.purity, - 'date': current_date - }, - 'board_rate') + current_date = getdate() + + aumms_item = frappe.get_doc("AuMMS Item", item_list) + + # Fetch the actual board rate value using the `board_rate` field from the selected Board Rate document + if board_rate: + board_rate_value = frappe.db.get_value("Board Rate", board_rate, "board_rate") + board_rate = float(board_rate_value) if board_rate_value else 0 + else: + board_rate = 0 + + try: + # Create new Stock Reconciliation document + doc = frappe.new_doc("Stock Reconciliation") + doc.purpose = "Opening Stock" + doc.expense_account = account + doc.date = current_date + + # Append item details with the retrieved board_rate + doc.append( + "items", + { + "item_code": aumms_item.item_code, + "warehouse": warehouse, + "qty": 1, + "valuation_rate": board_rate * aumms_item.gold_weight, + }, + ) - try: - doc = frappe.new_doc("Stock Reconciliation") - doc.purpose = "Opening Stock" - doc.expense_account = account - - doc.date = current_date - - doc.append( - "items", - { - "item_code": aumms_item.item_code, - "warehouse": warehouse, - "qty": 1, - "valuation_rate": board_rate * aumms_item.gold_weight if board_rate else 0, - }, - ) - doc.insert(ignore_permissions=True) - doc.submit() - - except Exception as e: - frappe.log_error(e) + # Insert and submit the Stock Reconciliation document + doc.insert(ignore_permissions=True) + return doc.name # Return the name for success message link + + except Exception as e: + frappe.log_error(frappe.get_traceback(), "Opening Stock Creation Error") + frappe.throw("An error occurred while creating the Opening Stock: {0}").format(str(e)) diff --git a/aumms/hooks.py b/aumms/hooks.py index a38cba50..a3bff10c 100644 --- a/aumms/hooks.py +++ b/aumms/hooks.py @@ -80,8 +80,12 @@ after_migrate = [ 'aumms.setup.setup_aumms_defaults', - 'aumms.aumms.utils.increase_precision' + 'aumms.aumms.utils.increase_precision', + 'aumms.setup.after_install' ] + +after_migrate = "aumms.setup.after_migrate" + # Uninstallation # ------------ diff --git a/aumms/setup.py b/aumms/setup.py index 37fd925a..ad862c01 100644 --- a/aumms/setup.py +++ b/aumms/setup.py @@ -1,5 +1,15 @@ import frappe from frappe import _ +from frappe.custom.doctype.custom_field.custom_field import create_custom_fields + + +def after_install(): + #Creating AuMMS specific custom fields + create_custom_fields(get_stock_reconciliation_custom_fields(), ignore_validate=True) + create_custom_fields(get_metal_ledger_custom_fields(), ignore_validate=True) + +def after_migrate(): + after_install() def is_setup_completed(): if frappe.db.get_single_value("System Settings", "setup_complete"): @@ -77,3 +87,36 @@ def create_department_for_smith(): department_doc.is_group = 1 department_doc.insert(ignore_permissions = True) frappe.db.commit() + + + +def get_stock_reconciliation_custom_fields(): + ''' + Custom fields that need to be added to the Stock Reconciliation Doctype + ''' + return { + "Stock Reconciliation": [ + { + "fieldname": "keep_metal_ledger", + "fieldtype": "Check", + "label": "Keep Metal Ledger", + "insert_after": "purpose" + } + ] + } + +def get_metal_ledger_custom_fields(): + ''' + Custom fields that need to be added to the Metal Ledger Entry Doctype + ''' + return { + "Metal Ledger Entry": [ + { + "fieldname": "entry_type", + "fieldtype": "Data", + "label": "Entry Type", + "insert_after": "voucher_type", + "read_only":1 + } + ] + } From 58661a5456305e8adb850fb0bdec08a9c0df4cad Mon Sep 17 00:00:00 2001 From: ajmalroshan123 Date: Wed, 6 Nov 2024 10:25:51 +0530 Subject: [PATCH 06/15] fix: refactored the code --- aumms/aumms/doctype/aumms_item/aumms_item.js | 1 - aumms/aumms/doctype/aumms_item/aumms_item.py | 13 ++++++------- .../jewellery_receipt/jewellery_receipt.py | 19 ------------------- 3 files changed, 6 insertions(+), 27 deletions(-) diff --git a/aumms/aumms/doctype/aumms_item/aumms_item.js b/aumms/aumms/doctype/aumms_item/aumms_item.js index 7f623171..277c4bf9 100644 --- a/aumms/aumms/doctype/aumms_item/aumms_item.js +++ b/aumms/aumms/doctype/aumms_item/aumms_item.js @@ -240,7 +240,6 @@ let calculate_stone_weight_and_charge = function(frm){ // Button to create Stock reconciliation -/////// frappe.ui.form.on('AuMMS Item', { refresh: function(frm) { diff --git a/aumms/aumms/doctype/aumms_item/aumms_item.py b/aumms/aumms/doctype/aumms_item/aumms_item.py index 747cf9c6..4926e48d 100644 --- a/aumms/aumms/doctype/aumms_item/aumms_item.py +++ b/aumms/aumms/doctype/aumms_item/aumms_item.py @@ -63,8 +63,6 @@ def validate_gold_weight(self): def after_insert(self): """Method to create Item from AuMMS Item""" self.create_or_update_item() - # if self.create_opening_stock: - # create_opening_stock([self.name]) def on_update(self): """Method to update created Item on changes of AuMMS Item""" @@ -175,7 +173,10 @@ def create_opening_stock_from_list(item_list_json): @frappe.whitelist() def create_opening_stock(item_list, board_rate=None): - # Retrieve the first available Warehouse and Account + """ + Function to create Opening Stock + """ + warehouse = frappe.db.exists("Warehouse", {"name": ["like", "%Stores%"]}) account = frappe.db.exists("Account", {"name": ["like", "%Temporary Opening%"]}) @@ -194,13 +195,11 @@ def create_opening_stock(item_list, board_rate=None): board_rate = 0 try: - # Create new Stock Reconciliation document doc = frappe.new_doc("Stock Reconciliation") doc.purpose = "Opening Stock" doc.expense_account = account doc.date = current_date - # Append item details with the retrieved board_rate doc.append( "items", { @@ -211,9 +210,9 @@ def create_opening_stock(item_list, board_rate=None): }, ) - # Insert and submit the Stock Reconciliation document + doc.insert(ignore_permissions=True) - return doc.name # Return the name for success message link + return doc.name except Exception as e: frappe.log_error(frappe.get_traceback(), "Opening Stock Creation Error") diff --git a/aumms/aumms/doctype/jewellery_receipt/jewellery_receipt.py b/aumms/aumms/doctype/jewellery_receipt/jewellery_receipt.py index 3b28f432..e6b64795 100644 --- a/aumms/aumms/doctype/jewellery_receipt/jewellery_receipt.py +++ b/aumms/aumms/doctype/jewellery_receipt/jewellery_receipt.py @@ -14,12 +14,6 @@ def autoname(self): item_code_parts = [self.item_category, str(item_detail.gold_weight)] if item_detail.has_stone: - # if item_detail.single_stone: - # item_code_parts.extend([item_detail.stone, str(item_detail.stone_weight)]) - # elif item_detail.multi_stone: - # stones = item_detail.stones.split(',') if item_detail.stones else [] - # for stone in stones: - # item_code_parts.append(stone) for stone in self.item_wise_stone_details: item_code_parts.append(stone.stone) @@ -100,22 +94,9 @@ def create_purchase_receipt(self): purchase_receipt.submit() frappe.msgprint('Purchase Receipt created.', indicator="green", alert=1) - # except frappe.DuplicateEntryError as e: - # # Handle duplicate entry error - # frappe.msgprint(f'Duplicate entry error: {e}', indicator="red", alert=1) - # except Exception as ex: - # # Handle other exceptions - # frappe.msgprint(f'Error: {ex}', indicator="red", alert=1) def calculate_item_details(self): for item_detail in self.get("item_details"): - # if item_detail.single_stone: - # if item_detail.stone_weight: - # item_detail.net_weight = item_detail.gold_weight + item_detail.stone_weight - # if item_detail.unit_stone_charge: - # item_detail.stone_charge = item_detail.unit_stone_charge * item_detail.stone_weight - # else: - # item_detail.net_weight = item_detail.gold_weight if self.board_rate: if item_detail.has_stone: item_detail.amount_without_making_charge = (item_detail.gold_weight * self.board_rate) + item_detail.stone_charge From bd12801d9dbf382444a06d2f84afb94834f686ae Mon Sep 17 00:00:00 2001 From: ajmalroshan123 Date: Wed, 6 Nov 2024 16:37:09 +0530 Subject: [PATCH 07/15] fix: Corrected the board rate value in Purchase Receipt --- .../jewellery_receipt/jewellery_receipt.py | 76 +++++++++---------- aumms/aumms/utils.py | 2 +- aumms/setup.py | 39 ++++++++++ 3 files changed, 74 insertions(+), 43 deletions(-) diff --git a/aumms/aumms/doctype/jewellery_receipt/jewellery_receipt.py b/aumms/aumms/doctype/jewellery_receipt/jewellery_receipt.py index e6b64795..f11788dc 100644 --- a/aumms/aumms/doctype/jewellery_receipt/jewellery_receipt.py +++ b/aumms/aumms/doctype/jewellery_receipt/jewellery_receipt.py @@ -1,5 +1,3 @@ -# Copyright (c) 2024, efeone and contributors -# For license information, please see license.txt import frappe from frappe.model.document import Document @@ -34,7 +32,6 @@ def make_form_read_only(self, fields): for field in fields: self.set(field, 'read_only', 1) - def create_item(self): for item_detail in self.get("item_details"): aumms_item = frappe.new_doc('AuMMS Item') @@ -49,7 +46,7 @@ def create_item(self): aumms_item.gold_weight = item_detail.gold_weight aumms_item.item_category = item_detail.item_category aumms_item.is_purchase_item = 1 - + if item_detail.hallmarked: aumms_item.hallmarked = 1 aumms_item.huid = item_detail.huid @@ -66,46 +63,41 @@ def create_item(self): aumms_item.insert(ignore_permissions=True) frappe.msgprint('AuMMS Item Created.', indicator="green", alert=1) - def create_purchase_receipt(self): - # Create a new Purchase Receipt - purchase_receipt = frappe.new_doc('Purchase Receipt') - purchase_receipt.supplier = self.supplier - # purchase_receipt.total_qty = self.quantity - purchase_receipt.keep_metal_ledger = 1 - - for item_detail in self.get("item_details"): - purchase_receipt.append('items', { - 'item_code': item_detail.item_code, - 'item_name': item_detail.item_code, - 'board_rate': self.board_rate, - 'qty': 1, - 'uom': "Nos", - "weight_per_unit": item_detail.gold_weight, - "weight_uom": item_detail.uom, - 'base_rate': item_detail.amount, - 'rate': item_detail.amount, - 'custom_making_charge': item_detail.making_charge, - 'custom_stone_weight': item_detail.stone_weight, - 'custom_stone_charge': item_detail.stone_charge, - - }) - purchase_receipt.insert(ignore_permissions=True) - purchase_receipt.submit() - frappe.msgprint('Purchase Receipt created.', indicator="green", alert=1) + purchase_receipt = frappe.new_doc('Purchase Receipt') + purchase_receipt.supplier = self.supplier + purchase_receipt.keep_metal_ledger = 1 + for item_detail in self.get("item_details"): + purchase_receipt.append('items', { + 'item_code': item_detail.item_code, + 'item_name': item_detail.item_code, + 'board_rate': self.board_rate or 0, + 'qty': 1, + 'uom': "Nos", + "weight_per_unit": item_detail.gold_weight, + "weight_uom": item_detail.uom, + 'base_rate': item_detail.amount, + 'rate': item_detail.amount, + 'making_charge': item_detail.making_charge or 0, + 'stone_weight': item_detail.stone_weight or 0, + 'stone_charge': item_detail.stone_charge or 0, + }) + purchase_receipt.insert(ignore_permissions=True) + purchase_receipt.submit() + frappe.msgprint('Purchase Receipt created.', indicator="green", alert=1) def calculate_item_details(self): for item_detail in self.get("item_details"): - if self.board_rate: - if item_detail.has_stone: - item_detail.amount_without_making_charge = (item_detail.gold_weight * self.board_rate) + item_detail.stone_charge - else: - item_detail.amount_without_making_charge = item_detail.gold_weight * self.board_rate - - if item_detail.amount_without_making_charge: - item_detail.making_charge = item_detail.amount_without_making_charge * (item_detail.making_chargein_percentage / 100) - - if item_detail.making_charge: - item_detail.amount = item_detail.amount_without_making_charge + item_detail.making_charge - frappe.db.commit() + board_rate = self.board_rate or 0 + stone_charge = item_detail.stone_charge or 0 + gold_weight = item_detail.gold_weight or 0 + making_chargein_percentage = item_detail.making_chargein_percentage or 0 + + if item_detail.has_stone: + item_detail.amount_without_making_charge = (gold_weight * board_rate) + stone_charge + else: + item_detail.amount_without_making_charge = gold_weight * board_rate + + item_detail.making_charge = item_detail.amount_without_making_charge * (making_chargein_percentage / 100) + item_detail.amount = item_detail.amount_without_making_charge + item_detail.making_charge diff --git a/aumms/aumms/utils.py b/aumms/aumms/utils.py index 201ee6c0..a53714e6 100644 --- a/aumms/aumms/utils.py +++ b/aumms/aumms/utils.py @@ -101,7 +101,7 @@ def create_metal_ledger_entries(doc, method=None): fields['stock_uom'] = item.weight_uom fields['purity'] = aumms_item_doc.purity fields['purity_percentage'] = aumms_item_doc.purity_percentage - fields['board_rate'] = item.rate + fields['board_rate'] = item.board_rate fields['batch_no'] = item.batch_no fields['item_type'] = aumms_item_doc.item_type # get balance qty of the item for this party diff --git a/aumms/setup.py b/aumms/setup.py index ad862c01..0b6eb839 100644 --- a/aumms/setup.py +++ b/aumms/setup.py @@ -7,6 +7,7 @@ def after_install(): #Creating AuMMS specific custom fields create_custom_fields(get_stock_reconciliation_custom_fields(), ignore_validate=True) create_custom_fields(get_metal_ledger_custom_fields(), ignore_validate=True) + create_custom_fields(get_purchase_receipt_custom_fields(), ignore_validate=True) def after_migrate(): after_install() @@ -120,3 +121,41 @@ def get_metal_ledger_custom_fields(): } ] } + + +def get_purchase_receipt_custom_fields(): + ''' + Custom fields that need to be added to the Purchase Receipt Doctype + ''' + return { + "Purchase Receipt":[ + + ], + "Purchase Receipt Item" : [ + { + "fieldname": "board_rate", + "fieldtype": "Data", + "label": "Board Rate", + "insert_after": "amount" + }, + { + "fieldname": "stone_weight", + "fieldtype": "Data", + "label": "Stone Weight", + "insert_after": "is_free_item" + }, + { + "fieldname": "stone_charge", + "fieldtype": "Data", + "label": "Stone Charge", + "insert_after": "stone_weight" + }, + { + "fieldname": "making_charge", + "fieldtype": "Data", + "label": "Making Charge", + "insert_after": "board_rate" + } + + ] + } From 5fbd73625c5c9e0e7a0e6aa70fe6c2fb15c52682 Mon Sep 17 00:00:00 2001 From: ajmalroshan123 Date: Fri, 8 Nov 2024 15:18:10 +0530 Subject: [PATCH 08/15] fix: refactored the code and fix the existing error --- .../jewellery_invoice/jewellery_invoice.js | 125 +++++++++++++++--- .../jewellery_invoice/jewellery_invoice.json | 4 +- .../jewellery_invoice/jewellery_invoice.py | 3 +- .../jewellery_item_receipt.json | 9 +- .../jewellery_receipt/jewellery_receipt.py | 1 + aumms/setup.py | 46 +++++++ 6 files changed, 162 insertions(+), 26 deletions(-) diff --git a/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.js b/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.js index bcafe0c3..b5daa1ca 100644 --- a/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.js +++ b/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.js @@ -638,30 +638,69 @@ frappe.ui.form.on('Jewellery Invoice Item', { } }); -// discount +// // discount -frappe.ui.form.on('Stone Detals - 2', { +// frappe.ui.form.on('Stone Detals - 2', { +// discount: function(frm, cdt, cdn) { +// calculate_discount_and_total(frm, cdt, cdn); +// } +// }); + +// function calculate_discount_and_total(frm, cdt, cdn) { +// let row = locals[cdt][cdn]; +// let discounted_amount = flt(row.stone_charge) * (1 - flt(row.discount) / 100); + +// // Update the row's final discounted amount +// frappe.model.set_value(cdt, cdn, 'custom_discount_final', discounted_amount); + +// // Calculate and set the total discounted amount +// let total = frm.doc.stone_details.reduce((sum, r) => +// sum + flt(r.stone_charge) * (1 - flt(r.discount) / 100), 0); + +// frm.set_value('custom_discount_final', total); +// frm.refresh_fields(['stone_details', 'custom_discount_final']); +// } + + +frappe.ui.form.on('Stone Details - 2', { discount: function(frm, cdt, cdn) { + calculate_discount_and_total(frm, cdt, cdn); + }, + stone_weight: function(frm, cdt, cdn) { calculate_discount_and_total(frm, cdt, cdn); } + }); function calculate_discount_and_total(frm, cdt, cdn) { let row = locals[cdt][cdn]; - let discounted_amount = flt(row.stone_charge) * (1 - flt(row.discount) / 100); + let final_amount; + + if (row.discount && flt(row.discount) !== 0) { + final_amount = flt(row.stone_charge) * (1 - flt(row.discount) / 100); + } else { + final_amount = flt(row.stone_charge); + } - // Update the row's final discounted amount - frappe.model.set_value(cdt, cdn, 'custom_discount_final', discounted_amount); + // Update the row's final amount + frappe.model.set_value(cdt, cdn, 'custom_discount_final', final_amount); + + // Calculate total by checking each row + let total = frm.doc.stone_details.reduce((sum, r) => { + if (r.discount && flt(r.discount) !== 0) { + return sum + flt(r.stone_charge) * (1 - flt(r.discount) / 100); + } else { + return sum + flt(r.stone_charge); + } + }, 0); - // Calculate and set the total discounted amount - let total = frm.doc.stone_details.reduce((sum, r) => - sum + flt(r.stone_charge) * (1 - flt(r.discount) / 100), 0); - frm.set_value('custom_discount_final', total); frm.refresh_fields(['stone_details', 'custom_discount_final']); } + + // code to set Grand Total frappe.ui.form.on('Jewellery Invoice', { @@ -674,6 +713,9 @@ frappe.ui.form.on('Jewellery Invoice', { }, custom_discount_final: function(frm) { calculate_total(frm); + }, + total_gold_amount: function(frm) { + calculate_total(frm); } }); @@ -744,6 +786,7 @@ function add_stone_details_to_table(frm, item_code, stone_details) { } // Apply pricing rules based on customer + function apply_pricing_rules(frm) { frappe.call({ method: "aumms.aumms.doctype.jewellery_invoice.jewellery_invoice.get_pricing_rule_and_items", @@ -751,31 +794,34 @@ function apply_pricing_rules(frm) { customer: frm.doc.customer }, callback: function(r) { - if (!r.message) return; + let discount_percentage = 0; + let rule_items = []; - let discount_percentage = r.message.discount_percentage; - let rule_items = r.message.rule_items || []; + if (r.message) { + discount_percentage = r.message.discount_percentage || 0; + rule_items = r.message.rule_items || []; + } update_stone_discounts(frm, discount_percentage, rule_items); } }); } -// Update discounts for matching stones +// Update discounts function update_stone_discounts(frm, discount_percentage, rule_items) { frm.doc.stone_details.forEach(function(stone) { + let matched_item = rule_items.find(function(item) { return item.item_code === stone.item_name; }); - if (matched_item) { - frappe.model.set_value( - stone.doctype, - stone.name, - 'discount', - discount_percentage - ); - } + // Apply discount if matched; otherwise, set discount to 0 + frappe.model.set_value( + stone.doctype, + stone.name, + 'discount', + matched_item ? discount_percentage : 0 + ); }); frm.refresh_field('stone_details'); @@ -824,4 +870,39 @@ function update_making_charge(frm, row, making_charge) { ); frm.refresh_field('items'); -} \ No newline at end of file +} + + +// code for discounted amount + +frappe.ui.form.on("Jewellery Invoice", { + refresh: function(frm) { + calculate_discounted_stone_charge_and_print(frm); + } +}); + +frappe.ui.form.on("Stone Details - 2", { + stone_charge: function(frm, cdt, cdn) { + calculate_discounted_stone_charge_and_print(frm); + }, + stone_details_add: function(frm) { + calculate_discounted_stone_charge_and_print(frm); + }, + custom_discount_final: function(frm) { + calculate_discounted_stone_charge_and_print(frm); + } +}); + +function calculate_discounted_stone_charge_and_print(frm) { + let total_stone_charge = 0; + + if (frm.doc.stone_details && frm.doc.stone_details.length) { + frm.doc.stone_details.forEach(row => { + let stone_charge = row.stone_charge || 0; + total_stone_charge += stone_charge ; + }); + } + let discount = total_stone_charge - frm.doc.custom_discount_final; + + frm.set_value("discount_amount", discount); +} diff --git a/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.json b/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.json index dc542c80..02a59fe5 100644 --- a/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.json +++ b/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.json @@ -406,14 +406,14 @@ "fieldname": "stone_details", "fieldtype": "Table", "label": "Stone Details", - "options": "Stone Detals - 2" + "options": "Stone Details - 2" } ], "hide_toolbar": 1, "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], - "modified": "2024-11-02 10:57:46.369218", + "modified": "2024-11-08 15:09:59.576364", "modified_by": "Administrator", "module": "AuMMS", "name": "Jewellery Invoice", diff --git a/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.py b/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.py index f58cbcc5..53fc8e95 100644 --- a/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.py +++ b/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.py @@ -529,7 +529,7 @@ def get_pricing_rule_and_items(customer): if pricing_rule: pricing_rule_name = pricing_rule[0].name - discount_percentage = pricing_rule[0].discount_percentage + discount_percentage = pricing_rule[0].discount_percentage if pricing_rule[0].discount_percentage else 0 rule_items = frappe.get_all( "Pricing Rule Item Code", @@ -544,3 +544,4 @@ def get_pricing_rule_and_items(customer): } return {} + diff --git a/aumms/aumms/doctype/jewellery_item_receipt/jewellery_item_receipt.json b/aumms/aumms/doctype/jewellery_item_receipt/jewellery_item_receipt.json index a17f8224..c2160410 100644 --- a/aumms/aumms/doctype/jewellery_item_receipt/jewellery_item_receipt.json +++ b/aumms/aumms/doctype/jewellery_item_receipt/jewellery_item_receipt.json @@ -24,6 +24,7 @@ "amount_without_making_charge", "amount", "hallmarked", + "is_sales_item", "huid", "section_break_lkhd", "has_stone", @@ -221,12 +222,18 @@ "fieldtype": "Data", "label": "HUID", "mandatory_depends_on": "eval: doc.hallmarked" + }, + { + "default": "0", + "fieldname": "is_sales_item", + "fieldtype": "Check", + "label": "Is Sales Item" } ], "index_web_pages_for_search": 1, "istable": 1, "links": [], - "modified": "2024-08-31 11:10:52.640578", + "modified": "2024-11-07 14:25:09.197843", "modified_by": "Administrator", "module": "AuMMS", "name": "Jewellery Item Receipt", diff --git a/aumms/aumms/doctype/jewellery_receipt/jewellery_receipt.py b/aumms/aumms/doctype/jewellery_receipt/jewellery_receipt.py index f11788dc..88621697 100644 --- a/aumms/aumms/doctype/jewellery_receipt/jewellery_receipt.py +++ b/aumms/aumms/doctype/jewellery_receipt/jewellery_receipt.py @@ -46,6 +46,7 @@ def create_item(self): aumms_item.gold_weight = item_detail.gold_weight aumms_item.item_category = item_detail.item_category aumms_item.is_purchase_item = 1 + aumms_item.is_sales_item = 1 if item_detail.is_sales_item else 0 if item_detail.hallmarked: aumms_item.hallmarked = 1 diff --git a/aumms/setup.py b/aumms/setup.py index 0b6eb839..1b63f269 100644 --- a/aumms/setup.py +++ b/aumms/setup.py @@ -8,6 +8,8 @@ def after_install(): create_custom_fields(get_stock_reconciliation_custom_fields(), ignore_validate=True) create_custom_fields(get_metal_ledger_custom_fields(), ignore_validate=True) create_custom_fields(get_purchase_receipt_custom_fields(), ignore_validate=True) + create_custom_fields(get_sales_invoice_custom_fields(), ignore_validate=True) + create_custom_fields(get_jewellery_invoice_custom_fields(), ignore_validate=True) def after_migrate(): after_install() @@ -159,3 +161,47 @@ def get_purchase_receipt_custom_fields(): ] } + + +def get_sales_invoice_custom_fields(): + ''' + Custom fields that need to be added to the Sales Invoice Doctype + ''' + return { + "Sales Invoice": [ + + ], + "Sales Invoice Item": [ + { + "fieldname": "board_rate", + "fieldtype": "Data", + "label": "Board Rate", + "insert_after": "amount" + } + ] + } + + +def get_jewellery_invoice_custom_fields(): + return { + "Jewellery Invoice": [ + { + "fieldname": "discounts", + "fieldtype": "Section Break", + "label": "Discounts", + "insert_after": "stone_details" + }, + { + "fieldname": "discount_amount", + "fieldtype": "Data", + "label": "Discount Amount", + "insert_after": "discounts" + }, + { + "fieldname": "discount_column_break", + "fieldtype": "Column Break", + "label": "", + "insert_after": "discount_amount" + } + ] + } From 494d255e535fe7abc55b0b0ed15dbd1f5e2f36e6 Mon Sep 17 00:00:00 2001 From: ajmalroshan123 Date: Fri, 8 Nov 2024 15:26:19 +0530 Subject: [PATCH 09/15] fix: refactored the code --- .../jewellery_invoice/jewellery_invoice.js | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.js b/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.js index b5daa1ca..c9375589 100644 --- a/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.js +++ b/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.js @@ -640,28 +640,6 @@ frappe.ui.form.on('Jewellery Invoice Item', { // // discount -// frappe.ui.form.on('Stone Detals - 2', { -// discount: function(frm, cdt, cdn) { -// calculate_discount_and_total(frm, cdt, cdn); -// } -// }); - -// function calculate_discount_and_total(frm, cdt, cdn) { -// let row = locals[cdt][cdn]; -// let discounted_amount = flt(row.stone_charge) * (1 - flt(row.discount) / 100); - -// // Update the row's final discounted amount -// frappe.model.set_value(cdt, cdn, 'custom_discount_final', discounted_amount); - -// // Calculate and set the total discounted amount -// let total = frm.doc.stone_details.reduce((sum, r) => -// sum + flt(r.stone_charge) * (1 - flt(r.discount) / 100), 0); - -// frm.set_value('custom_discount_final', total); -// frm.refresh_fields(['stone_details', 'custom_discount_final']); -// } - - frappe.ui.form.on('Stone Details - 2', { discount: function(frm, cdt, cdn) { calculate_discount_and_total(frm, cdt, cdn); From 67ff306fe7e2e4cef09bccd8be1722428921927d Mon Sep 17 00:00:00 2001 From: ajmalroshan123 Date: Mon, 11 Nov 2024 09:54:53 +0530 Subject: [PATCH 10/15] fix: updated the logic to set default value --- aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.js b/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.js index c9375589..16cb1b8c 100644 --- a/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.js +++ b/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.js @@ -880,7 +880,7 @@ function calculate_discounted_stone_charge_and_print(frm) { total_stone_charge += stone_charge ; }); } - let discount = total_stone_charge - frm.doc.custom_discount_final; + let discount = total_stone_charge - frm.doc.custom_discount_final || 0; frm.set_value("discount_amount", discount); } From 43749be76bc19d1ac68735d8f3522ba27078641d Mon Sep 17 00:00:00 2001 From: ajmalroshan123 Date: Mon, 11 Nov 2024 10:10:34 +0530 Subject: [PATCH 11/15] fix: corrected the mistake in code --- aumms/hooks.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/aumms/hooks.py b/aumms/hooks.py index a3bff10c..385907b6 100644 --- a/aumms/hooks.py +++ b/aumms/hooks.py @@ -74,17 +74,20 @@ # ------------ # before_install = "aumms.install.before_install" -# after_install = [ -# 'aumms.setup.setup_aumms_defaults' -# ] + + +after_install = [ + 'aumms.setup.setup_aumms_defaults', + 'aumms.setup.after_install' + ] after_migrate = [ 'aumms.setup.setup_aumms_defaults', 'aumms.aumms.utils.increase_precision', - 'aumms.setup.after_install' + 'aumms.setup.after_migrate' + ] -after_migrate = "aumms.setup.after_migrate" # Uninstallation # ------------ From c1554eb47c07184078d4436bdc5e686256035ab3 Mon Sep 17 00:00:00 2001 From: ajmalroshan123 Date: Mon, 11 Nov 2024 10:26:19 +0530 Subject: [PATCH 12/15] fix: Avoided all the unwanted code --- aumms/fixtures/custom_field.json | 4146 ++++++++++---------- aumms/fixtures/designation.json | 20 +- aumms/fixtures/role.json | 240 +- aumms/fixtures/workflow_action_master.json | 81 +- 4 files changed, 2231 insertions(+), 2256 deletions(-) diff --git a/aumms/fixtures/custom_field.json b/aumms/fixtures/custom_field.json index a926017f..de02b8a0 100644 --- a/aumms/fixtures/custom_field.json +++ b/aumms/fixtures/custom_field.json @@ -1,2111 +1,2037 @@ [ - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": null, - "description": "", - "docstatus": 0, - "doctype": "Custom Field", - "dt": "UOM", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "is_purity_uom", - "fieldtype": "Check", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "column_break_3", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Is Purity UOM", - "length": 0, - "link_filters": null, - "mandatory_depends_on": null, - "modified": "2023-01-05 10:33:35.446753", - "module": null, - "name": "UOM-is_purity_uom", - "no_copy": 0, - "non_negative": 0, - "options": null, - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Jewellery Invoice", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "custom_total_taxes_and_charges_company_currency", - "fieldtype": "Currency", - "hidden": 1, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "custom_section_break_qv4uh", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Total Taxes and Charges (Company Currency)", - "length": 0, - "link_filters": null, - "mandatory_depends_on": null, - "modified": "2024-02-07 22:15:11.279549", - "module": null, - "name": "Jewellery Invoice-custom_total_taxes_and_charges_company_currency", - "no_copy": 0, - "non_negative": 0, - "options": "Company:company:default_currency", - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 1, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 1, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Jewellery Invoice", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "custom_total_taxes_and_charges", - "fieldtype": "Currency", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "custom_column_break_1zplm", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Total Taxes and Charges", - "length": 0, - "link_filters": null, - "mandatory_depends_on": null, - "modified": "2024-02-07 22:15:11.742343", - "module": null, - "name": "Jewellery Invoice-custom_total_taxes_and_charges", - "no_copy": 0, - "non_negative": 0, - "options": "currency", - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 1, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 1, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": "eval:doc.is_purity_item", - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Item", - "fetch_from": "purity.purity_percentage", - "fetch_if_empty": 0, - "fieldname": "purity_percentage", - "fieldtype": "Percent", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "purity", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Purity Percentage", - "length": 0, - "link_filters": null, - "mandatory_depends_on": null, - "modified": "2023-01-06 14:48:46.579229", - "module": null, - "name": "Item-purity_percentage", - "no_copy": 0, - "non_negative": 0, - "options": null, - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 1, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": "0", - "depends_on": "has_stone", - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Item", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "stone_charge", - "fieldtype": "Currency", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "stone_weight", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Stone Charge", - "length": 0, - "link_filters": null, - "mandatory_depends_on": null, - "modified": "2023-08-10 16:22:43.694341", - "module": null, - "name": "Item-stone_charge", - "no_copy": 0, - "non_negative": 0, - "options": null, - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Item", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "custom_item_qr_code", - "fieldtype": "Image", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "item_qr", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Item QR Code", - "length": 0, - "link_filters": null, - "mandatory_depends_on": null, - "modified": "2024-02-15 12:27:24.365547", - "module": null, - "name": "Item-custom_item_qr_code", - "no_copy": 0, - "non_negative": 0, - "options": "item_qr", - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Department", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "head_of_department", - "fieldtype": "Link", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "parent_department", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Head of Department", - "length": 0, - "link_filters": null, - "mandatory_depends_on": null, - "modified": "2023-10-20 15:16:08.680216", - "module": null, - "name": "Department-head_of_department", - "no_copy": 0, - "non_negative": 0, - "options": "Employee", - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Purchase Invoice", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "keep_metal_ledger", - "fieldtype": "Check", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "supplier", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Keep Metal Ledger", - "length": 0, - "link_filters": null, - "mandatory_depends_on": null, - "modified": "2023-01-19 17:11:57.835012", - "module": null, - "name": "Purchase Invoice-keep_metal_ledger", - "no_copy": 0, - "non_negative": 0, - "options": null, - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Item Group", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "is_aumms_item_group", - "fieldtype": "Check", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "image", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Is AuMMS Item Group", - "length": 0, - "link_filters": null, - "mandatory_depends_on": null, - "modified": "2023-08-10 16:44:07.982502", - "module": null, - "name": "Item Group-is_aumms_item_group", - "no_copy": 0, - "non_negative": 0, - "options": null, - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 1, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Job Card", - "fetch_from": "work_order.assigned_to", - "fetch_if_empty": 0, - "fieldname": "assigned_to", - "fieldtype": "Link", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "employee", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Assigned To", - "length": 0, - "link_filters": null, - "mandatory_depends_on": null, - "modified": "2023-11-15 12:12:19.890413", - "module": null, - "name": "Job Card-assigned_to", - "no_copy": 0, - "non_negative": 0, - "options": "Smith", - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Job Card", - "fetch_from": "assigned_to.employee", - "fetch_if_empty": 0, - "fieldname": "assigned_employee", - "fieldtype": "Link", - "hidden": 1, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "assigned_to", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Assigned Employee", - "length": 0, - "link_filters": null, - "mandatory_depends_on": null, - "modified": "2023-11-15 12:32:11.204644", - "module": null, - "name": "Job Card-assigned_employee", - "no_copy": 0, - "non_negative": 0, - "options": "Employee", - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 1, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 1, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": "", - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Item", - "fetch_from": "item_group.item_type", - "fetch_if_empty": 1, - "fieldname": "item_type", - "fieldtype": "Link", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "item_group", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Item Type", - "length": 0, - "link_filters": null, - "mandatory_depends_on": "", - "modified": "2023-01-06 16:49:20.501863", - "module": null, - "name": "Item-item_type", - "no_copy": 0, - "non_negative": 0, - "options": "Item Type", - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Item Group", - "fetch_from": "parent_item_group.item_type", - "fetch_if_empty": 1, - "fieldname": "item_type", - "fieldtype": "Link", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "column_break_5", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Item Type", - "length": 0, - "link_filters": null, - "mandatory_depends_on": null, - "modified": "2023-01-05 15:09:57.352372", - "module": null, - "name": "Item Group-item_type", - "no_copy": 0, - "non_negative": 0, - "options": "Item Type", - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": "", - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Purchase Receipt", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "party_link", - "fieldtype": "Link", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "supplier_delivery_note", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Party Link", - "length": 0, - "link_filters": null, - "mandatory_depends_on": null, - "modified": "2023-01-27 16:49:36.956964", - "module": null, - "name": "Purchase Receipt-party_link", - "no_copy": 0, - "non_negative": 0, - "options": "Party Link", - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 1, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Employee", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "custom_warehouse", - "fieldtype": "Link", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "employee_name", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Warehouse", - "length": 0, - "link_filters": null, - "mandatory_depends_on": null, - "modified": "2024-04-29 14:36:36.781226", - "module": null, - "name": "Employee-custom_warehouse", - "no_copy": 0, - "non_negative": 0, - "options": "Warehouse", - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": "", - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Item Group", - "fetch_from": "item_type.is_purity_item", - "fetch_if_empty": 0, - "fieldname": "is_purity_item", - "fieldtype": "Check", - "hidden": 1, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "item_type", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Is Purity Item", - "length": 0, - "link_filters": null, - "mandatory_depends_on": null, - "modified": "2023-01-31 12:41:20.505617", - "module": null, - "name": "Item Group-is_purity_item", - "no_copy": 0, - "non_negative": 0, - "options": null, - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 1, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": "eval:doc.is_purity_item", - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Item", - "fetch_from": "item_group.making_charge_based_on", - "fetch_if_empty": 1, - "fieldname": "making_charge_based_on", - "fieldtype": "Select", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "stock_uom", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Making Charge Based On", - "length": 0, - "link_filters": null, - "mandatory_depends_on": null, - "modified": "2023-01-05 17:32:05.643181", - "module": null, - "name": "Item-making_charge_based_on", - "no_copy": 0, - "non_negative": 0, - "options": "\nFixed\nPercentage", - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 1, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": "eval: doc.is_purity_item", - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Item Group", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "making_charge_based_on", - "fieldtype": "Select", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "is_purity_item", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Making Charge Based On", - "length": 0, - "link_filters": null, - "mandatory_depends_on": null, - "modified": "2023-01-05 10:54:18.536026", - "module": null, - "name": "Item Group-making_charge_based_on", - "no_copy": 0, - "non_negative": 0, - "options": "\nFixed\nPercentage", - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": "eval: doc.making_charge_based_on == 'Percentage' && doc.is_purity_item", - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Item", - "fetch_from": "item_group.percentage", - "fetch_if_empty": 1, - "fieldname": "making_charge_percentage", - "fieldtype": "Percent", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "making_charge_based_on", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Making Charge Percentage", - "length": 0, - "link_filters": null, - "mandatory_depends_on": "eval: doc.making_charge_based_on == 'Percentage'", - "modified": "2023-01-05 15:09:29.804481", - "module": null, - "name": "Item-making_charge_percentage", - "no_copy": 0, - "non_negative": 0, - "options": null, - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": "eval: doc.making_charge_based_on == 'Percentage'", - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Item Group", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "percentage", - "fieldtype": "Percent", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "making_charge_based_on", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Percentage", - "length": 0, - "link_filters": null, - "mandatory_depends_on": "eval: doc.making_charge_based_on == 'Percentage'", - "modified": "2023-01-05 11:41:02.132844", - "module": null, - "name": "Item Group-percentage", - "no_copy": 0, - "non_negative": 0, - "options": null, - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": "eval: doc.making_charge_based_on == 'Fixed' && doc.is_purity_item", - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Item", - "fetch_from": "item_group.currency", - "fetch_if_empty": 1, - "fieldname": "making_charge", - "fieldtype": "Currency", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "making_charge_percentage", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Making Charge", - "length": 0, - "link_filters": null, - "mandatory_depends_on": "eval: doc.making_charge_based_on == 'Fixed'", - "modified": "2023-01-06 11:28:22.995811", - "module": null, - "name": "Item-making_charge", - "no_copy": 0, - "non_negative": 0, - "options": null, - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": "eval: doc.making_charge_based_on == 'Fixed'", - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Item Group", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "currency", - "fieldtype": "Currency", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "percentage", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Currency", - "length": 0, - "link_filters": null, - "mandatory_depends_on": "eval: doc.making_charge_based_on == 'Fixed'", - "modified": "2023-01-05 12:43:08.976116", - "module": null, - "name": "Item Group-currency", - "no_copy": 0, - "non_negative": 0, - "options": null, - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Item Group", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "is_sales_item", - "fieldtype": "Check", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "currency", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Is Sales Item", - "length": 0, - "link_filters": null, - "mandatory_depends_on": null, - "modified": "2023-01-11 15:57:23.780415", - "module": null, - "name": "Item Group-is_sales_item", - "no_copy": 0, - "non_negative": 0, - "options": null, - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Purchase Receipt", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "keep_metal_ledger", - "fieldtype": "Check", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "set_posting_time", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Keep Metal Ledger", - "length": 0, - "link_filters": null, - "mandatory_depends_on": null, - "modified": "2023-01-19 16:51:12.721967", - "module": null, - "name": "Purchase Receipt-keep_metal_ledger", - "no_copy": 0, - "non_negative": 0, - "options": null, - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Item Group", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "is_purchase_item", - "fieldtype": "Check", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "is_sales_item", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Is Purchase Item", - "length": 0, - "link_filters": null, - "mandatory_depends_on": null, - "modified": "2023-01-11 15:57:25.254765", - "module": null, - "name": "Item Group-is_purchase_item", - "no_copy": 0, - "non_negative": 0, - "options": null, - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Purchase Receipt", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "create_invoice_on_submit", - "fieldtype": "Check", - "hidden": 1, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "keep_metal_ledger", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Create Invoice on Submit", - "length": 0, - "link_filters": null, - "mandatory_depends_on": null, - "modified": "2023-08-23 15:44:29.173542", - "module": null, - "name": "Purchase Receipt-create_invoice_on_submit", - "no_copy": 0, - "non_negative": 0, - "options": null, - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 1, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Item", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "is_aumms_item", - "fieldtype": "Check", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "disabled", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Is AuMMS Item", - "length": 0, - "link_filters": null, - "mandatory_depends_on": null, - "modified": "2023-08-10 16:32:46.294462", - "module": null, - "name": "Item-is_aumms_item", - "no_copy": 0, - "non_negative": 0, - "options": null, - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 1, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Work Order", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "assigned_to", - "fieldtype": "Link", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "project", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Assigned To", - "length": 0, - "link_filters": null, - "mandatory_depends_on": null, - "modified": "2023-11-14 12:22:34.239256", - "module": null, - "name": "Work Order-assigned_to", - "no_copy": 0, - "non_negative": 0, - "options": "Smith", - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Purchase Invoice Item", - "fetch_from": "item_code.item_type", - "fetch_if_empty": 0, - "fieldname": "item_type", - "fieldtype": "Link", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "rejected_qty", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Item Type", - "length": 0, - "link_filters": null, - "mandatory_depends_on": null, - "modified": "2023-01-11 12:31:08.595209", - "module": null, - "name": "Purchase Invoice Item-item_type", - "no_copy": 0, - "non_negative": 0, - "options": "Item Type", - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Item", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "custom_is_raw_material", - "fieldtype": "Check", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "is_aumms_item", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Is Raw Material", - "length": 0, - "link_filters": null, - "mandatory_depends_on": null, - "modified": "2024-03-20 12:16:05.286660", - "module": null, - "name": "Item-custom_is_raw_material", - "no_copy": 0, - "non_negative": 0, - "options": null, - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Work Order", - "fetch_from": "assigned_to.smith_name", - "fetch_if_empty": 1, - "fieldname": "smith_name", - "fieldtype": "Data", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "assigned_to", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Smith Name", - "length": 0, - "link_filters": null, - "mandatory_depends_on": null, - "modified": "2023-11-14 12:48:04.270472", - "module": null, - "name": "Work Order-smith_name", - "no_copy": 0, - "non_negative": 0, - "options": null, - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Sales Order", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "keep_metal_ledger", - "fieldtype": "Check", - "hidden": 1, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "amended_from", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Keep Metal Ledger", - "length": 0, - "link_filters": null, - "mandatory_depends_on": null, - "modified": "2023-08-23 15:14:10.150999", - "module": null, - "name": "Sales Order-keep_metal_ledger", - "no_copy": 0, - "non_negative": 0, - "options": null, - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 1, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Jewellery Invoice", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "custom_taxes_and_charges", - "fieldtype": "Section Break", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "total_gold_amount", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Taxes and Charges", - "length": 0, - "link_filters": null, - "mandatory_depends_on": null, - "modified": "2024-02-07 22:15:10.690293", - "module": null, - "name": "Jewellery Invoice-custom_taxes_and_charges", - "no_copy": 0, - "non_negative": 0, - "options": null, - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Sales Invoice", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "keep_metal_ledger", - "fieldtype": "Check", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "is_debit_note", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Keep Metal Ledger", - "length": 0, - "link_filters": null, - "mandatory_depends_on": null, - "modified": "2023-01-19 15:29:50.710586", - "module": null, - "name": "Sales Invoice-keep_metal_ledger", - "no_copy": 0, - "non_negative": 0, - "options": null, - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Jewellery Invoice", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "custom_sales_taxes_and_charges", - "fieldtype": "Table", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "sales_taxes_and_charges_template", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Sales Taxes and Charges", - "length": 0, - "link_filters": null, - "mandatory_depends_on": null, - "modified": "2024-02-07 22:15:11.034978", - "module": null, - "name": "Jewellery Invoice-custom_sales_taxes_and_charges", - "no_copy": 0, - "non_negative": 0, - "options": "Sales Taxes and Charges", - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": "0", - "depends_on": "", - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Item", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "gold_weight", - "fieldtype": "Float", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "warranty_period", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Gold Weight", - "length": 0, - "link_filters": null, - "mandatory_depends_on": "", - "modified": "2023-08-10 16:25:51.557590", - "module": null, - "name": "Item-gold_weight", - "no_copy": 0, - "non_negative": 0, - "options": null, - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "default": null, - "depends_on": "", - "description": null, - "docstatus": 0, - "doctype": "Custom Field", - "dt": "Item", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "has_stone", - "fieldtype": "Check", - "hidden": 0, - "hide_border": 0, - "hide_days": 0, - "hide_seconds": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_preview": 0, - "in_standard_filter": 0, - "insert_after": "weight_uom", - "is_system_generated": 0, - "is_virtual": 0, - "label": "Has Stone", - "length": 0, - "link_filters": null, - "mandatory_depends_on": null, - "modified": "2023-08-10 16:19:51.484765", - "module": null, - "name": "Item-has_stone", - "no_copy": 0, - "non_negative": 0, - "options": null, - "permlevel": 0, - "placeholder": null, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "read_only_depends_on": null, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "show_dashboard": 0, - "sort_options": 0, - "translatable": 0, - "unique": 0, - "width": null - } -] \ No newline at end of file + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": "", + "docstatus": 0, + "doctype": "Custom Field", + "dt": "UOM", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "is_purity_uom", + "fieldtype": "Check", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "column_break_3", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Is Purity UOM", + "length": 0, + "mandatory_depends_on": null, + "modified": "2023-01-05 10:33:35.446753", + "module": null, + "name": "UOM-is_purity_uom", + "no_copy": 0, + "non_negative": 0, + "options": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Jewellery Invoice", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "custom_total_taxes_and_charges_company_currency", + "fieldtype": "Currency", + "hidden": 1, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "custom_section_break_qv4uh", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Total Taxes and Charges (Company Currency)", + "length": 0, + "mandatory_depends_on": null, + "modified": "2024-02-07 22:15:11.279549", + "module": null, + "name": "Jewellery Invoice-custom_total_taxes_and_charges_company_currency", + "no_copy": 0, + "non_negative": 0, + "options": "Company:company:default_currency", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 1, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Jewellery Invoice", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "custom_total_taxes_and_charges", + "fieldtype": "Currency", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "custom_column_break_1zplm", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Total Taxes and Charges", + "length": 0, + "mandatory_depends_on": null, + "modified": "2024-02-07 22:15:11.742343", + "module": null, + "name": "Jewellery Invoice-custom_total_taxes_and_charges", + "no_copy": 0, + "non_negative": 0, + "options": "currency", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 1, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Department", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "head_of_department", + "fieldtype": "Link", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "parent_department", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Head of Department", + "length": 0, + "mandatory_depends_on": null, + "modified": "2023-10-20 15:16:08.680216", + "module": null, + "name": "Department-head_of_department", + "no_copy": 0, + "non_negative": 0, + "options": "Employee", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Purchase Invoice", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "keep_metal_ledger", + "fieldtype": "Check", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "supplier", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Keep Metal Ledger", + "length": 0, + "mandatory_depends_on": null, + "modified": "2023-01-19 17:11:57.835012", + "module": null, + "name": "Purchase Invoice-keep_metal_ledger", + "no_copy": 0, + "non_negative": 0, + "options": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Item Group", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "is_aumms_item_group", + "fieldtype": "Check", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "image", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Is AuMMS Item Group", + "length": 0, + "mandatory_depends_on": null, + "modified": "2023-08-10 16:44:07.982502", + "module": null, + "name": "Item Group-is_aumms_item_group", + "no_copy": 0, + "non_negative": 0, + "options": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 1, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Job Card", + "fetch_from": "work_order.assigned_to", + "fetch_if_empty": 0, + "fieldname": "assigned_to", + "fieldtype": "Link", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "employee", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Assigned To", + "length": 0, + "mandatory_depends_on": null, + "modified": "2023-11-15 12:12:19.890413", + "module": null, + "name": "Job Card-assigned_to", + "no_copy": 0, + "non_negative": 0, + "options": "Smith", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 1, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": "", + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Item", + "fetch_from": "item_group.item_type", + "fetch_if_empty": 1, + "fieldname": "item_type", + "fieldtype": "Link", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "item_group", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Item Type", + "length": 0, + "mandatory_depends_on": "", + "modified": "2023-01-06 16:49:20.501863", + "module": null, + "name": "Item-item_type", + "no_copy": 0, + "non_negative": 0, + "options": "Item Type", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Job Card", + "fetch_from": "assigned_to.employee", + "fetch_if_empty": 0, + "fieldname": "assigned_employee", + "fieldtype": "Link", + "hidden": 1, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "assigned_to", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Assigned Employee", + "length": 0, + "mandatory_depends_on": null, + "modified": "2023-11-15 12:32:11.204644", + "module": null, + "name": "Job Card-assigned_employee", + "no_copy": 0, + "non_negative": 0, + "options": "Employee", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 1, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Item Group", + "fetch_from": "parent_item_group.item_type", + "fetch_if_empty": 1, + "fieldname": "item_type", + "fieldtype": "Link", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "column_break_5", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Item Type", + "length": 0, + "mandatory_depends_on": null, + "modified": "2023-01-05 15:09:57.352372", + "module": null, + "name": "Item Group-item_type", + "no_copy": 0, + "non_negative": 0, + "options": "Item Type", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": "", + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Purchase Receipt", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "party_link", + "fieldtype": "Link", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "supplier_delivery_note", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Party Link", + "length": 0, + "mandatory_depends_on": null, + "modified": "2023-01-27 16:49:36.956964", + "module": null, + "name": "Purchase Receipt-party_link", + "no_copy": 0, + "non_negative": 0, + "options": "Party Link", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 1, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": "eval:doc.is_purity_item", + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Item", + "fetch_from": "item_group.making_charge_based_on", + "fetch_if_empty": 1, + "fieldname": "making_charge_based_on", + "fieldtype": "Select", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "stock_uom", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Making Charge Based On", + "length": 0, + "mandatory_depends_on": null, + "modified": "2023-01-05 17:32:05.643181", + "module": null, + "name": "Item-making_charge_based_on", + "no_copy": 0, + "non_negative": 0, + "options": "\nFixed\nPercentage", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 1, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Employee", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "custom_warehouse", + "fieldtype": "Link", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "employee_name", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Warehouse", + "length": 0, + "mandatory_depends_on": null, + "modified": "2024-04-29 14:36:36.781226", + "module": null, + "name": "Employee-custom_warehouse", + "no_copy": 0, + "non_negative": 0, + "options": "Warehouse", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": "", + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Item Group", + "fetch_from": "item_type.is_purity_item", + "fetch_if_empty": 0, + "fieldname": "is_purity_item", + "fieldtype": "Check", + "hidden": 1, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "item_type", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Is Purity Item", + "length": 0, + "mandatory_depends_on": null, + "modified": "2023-01-31 12:41:20.505617", + "module": null, + "name": "Item Group-is_purity_item", + "no_copy": 0, + "non_negative": 0, + "options": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 1, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": "eval: doc.is_purity_item", + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Item Group", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "making_charge_based_on", + "fieldtype": "Select", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "is_purity_item", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Making Charge Based On", + "length": 0, + "mandatory_depends_on": null, + "modified": "2023-01-05 10:54:18.536026", + "module": null, + "name": "Item Group-making_charge_based_on", + "no_copy": 0, + "non_negative": 0, + "options": "\nFixed\nPercentage", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": "eval: doc.making_charge_based_on == 'Percentage' && doc.is_purity_item", + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Item", + "fetch_from": "item_group.percentage", + "fetch_if_empty": 1, + "fieldname": "making_charge_percentage", + "fieldtype": "Percent", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "making_charge_based_on", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Making Charge Percentage", + "length": 0, + "mandatory_depends_on": "eval: doc.making_charge_based_on == 'Percentage'", + "modified": "2023-01-05 15:09:29.804481", + "module": null, + "name": "Item-making_charge_percentage", + "no_copy": 0, + "non_negative": 0, + "options": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": "eval: doc.making_charge_based_on == 'Percentage'", + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Item Group", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "percentage", + "fieldtype": "Percent", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "making_charge_based_on", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Percentage", + "length": 0, + "mandatory_depends_on": "eval: doc.making_charge_based_on == 'Percentage'", + "modified": "2023-01-05 11:41:02.132844", + "module": null, + "name": "Item Group-percentage", + "no_copy": 0, + "non_negative": 0, + "options": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": "eval: doc.making_charge_based_on == 'Fixed' && doc.is_purity_item", + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Item", + "fetch_from": "item_group.currency", + "fetch_if_empty": 1, + "fieldname": "making_charge", + "fieldtype": "Currency", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "making_charge_percentage", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Making Charge", + "length": 0, + "mandatory_depends_on": "eval: doc.making_charge_based_on == 'Fixed'", + "modified": "2023-01-06 11:28:22.995811", + "module": null, + "name": "Item-making_charge", + "no_copy": 0, + "non_negative": 0, + "options": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": "eval: doc.making_charge_based_on == 'Fixed'", + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Item Group", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "currency", + "fieldtype": "Currency", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "percentage", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Currency", + "length": 0, + "mandatory_depends_on": "eval: doc.making_charge_based_on == 'Fixed'", + "modified": "2023-01-05 12:43:08.976116", + "module": null, + "name": "Item Group-currency", + "no_copy": 0, + "non_negative": 0, + "options": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Item Group", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "is_sales_item", + "fieldtype": "Check", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "currency", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Is Sales Item", + "length": 0, + "mandatory_depends_on": null, + "modified": "2023-01-11 15:57:23.780415", + "module": null, + "name": "Item Group-is_sales_item", + "no_copy": 0, + "non_negative": 0, + "options": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Purchase Receipt", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "keep_metal_ledger", + "fieldtype": "Check", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "set_posting_time", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Keep Metal Ledger", + "length": 0, + "mandatory_depends_on": null, + "modified": "2023-01-19 16:51:12.721967", + "module": null, + "name": "Purchase Receipt-keep_metal_ledger", + "no_copy": 0, + "non_negative": 0, + "options": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Item Group", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "is_purchase_item", + "fieldtype": "Check", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "is_sales_item", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Is Purchase Item", + "length": 0, + "mandatory_depends_on": null, + "modified": "2023-01-11 15:57:25.254765", + "module": null, + "name": "Item Group-is_purchase_item", + "no_copy": 0, + "non_negative": 0, + "options": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": "eval:doc.is_purity_item", + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Item", + "fetch_from": "purity.purity_percentage", + "fetch_if_empty": 0, + "fieldname": "purity_percentage", + "fieldtype": "Percent", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "purity", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Purity Percentage", + "length": 0, + "mandatory_depends_on": null, + "modified": "2023-01-06 14:48:46.579229", + "module": null, + "name": "Item-purity_percentage", + "no_copy": 0, + "non_negative": 0, + "options": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 1, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Purchase Receipt", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "create_invoice_on_submit", + "fieldtype": "Check", + "hidden": 1, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "keep_metal_ledger", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Create Invoice on Submit", + "length": 0, + "mandatory_depends_on": null, + "modified": "2023-08-23 15:44:29.173542", + "module": null, + "name": "Purchase Receipt-create_invoice_on_submit", + "no_copy": 0, + "non_negative": 0, + "options": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 1, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Work Order", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "assigned_to", + "fieldtype": "Link", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "project", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Assigned To", + "length": 0, + "mandatory_depends_on": null, + "modified": "2023-11-14 12:22:34.239256", + "module": null, + "name": "Work Order-assigned_to", + "no_copy": 0, + "non_negative": 0, + "options": "Smith", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Purchase Invoice Item", + "fetch_from": "item_code.item_type", + "fetch_if_empty": 0, + "fieldname": "item_type", + "fieldtype": "Link", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "rejected_qty", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Item Type", + "length": 0, + "mandatory_depends_on": null, + "modified": "2023-01-11 12:31:08.595209", + "module": null, + "name": "Purchase Invoice Item-item_type", + "no_copy": 0, + "non_negative": 0, + "options": "Item Type", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Work Order", + "fetch_from": "assigned_to.smith_name", + "fetch_if_empty": 1, + "fieldname": "smith_name", + "fieldtype": "Data", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "assigned_to", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Smith Name", + "length": 0, + "mandatory_depends_on": null, + "modified": "2023-11-14 12:48:04.270472", + "module": null, + "name": "Work Order-smith_name", + "no_copy": 0, + "non_negative": 0, + "options": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Item", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "is_aumms_item", + "fieldtype": "Check", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "disabled", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Is AuMMS Item", + "length": 0, + "mandatory_depends_on": null, + "modified": "2023-08-10 16:32:46.294462", + "module": null, + "name": "Item-is_aumms_item", + "no_copy": 0, + "non_negative": 0, + "options": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 1, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Item", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "custom_is_raw_material", + "fieldtype": "Check", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "is_aumms_item", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Is Raw Material", + "length": 0, + "mandatory_depends_on": null, + "modified": "2024-03-20 12:16:05.286660", + "module": null, + "name": "Item-custom_is_raw_material", + "no_copy": 0, + "non_negative": 0, + "options": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Sales Order", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "keep_metal_ledger", + "fieldtype": "Check", + "hidden": 1, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "amended_from", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Keep Metal Ledger", + "length": 0, + "mandatory_depends_on": null, + "modified": "2023-08-23 15:14:10.150999", + "module": null, + "name": "Sales Order-keep_metal_ledger", + "no_copy": 0, + "non_negative": 0, + "options": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 1, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Jewellery Invoice", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "custom_taxes_and_charges", + "fieldtype": "Section Break", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "total_gold_amount", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Taxes and Charges", + "length": 0, + "mandatory_depends_on": null, + "modified": "2024-02-07 22:15:10.690293", + "module": null, + "name": "Jewellery Invoice-custom_taxes_and_charges", + "no_copy": 0, + "non_negative": 0, + "options": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Sales Invoice", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "keep_metal_ledger", + "fieldtype": "Check", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "is_debit_note", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Keep Metal Ledger", + "length": 0, + "mandatory_depends_on": null, + "modified": "2023-01-19 15:29:50.710586", + "module": null, + "name": "Sales Invoice-keep_metal_ledger", + "no_copy": 0, + "non_negative": 0, + "options": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Jewellery Invoice", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "custom_sales_taxes_and_charges", + "fieldtype": "Table", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "sales_taxes_and_charges_template", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Sales Taxes and Charges", + "length": 0, + "mandatory_depends_on": null, + "modified": "2024-02-07 22:15:11.034978", + "module": null, + "name": "Jewellery Invoice-custom_sales_taxes_and_charges", + "no_copy": 0, + "non_negative": 0, + "options": "Sales Taxes and Charges", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Item", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "custom_item_qr_code", + "fieldtype": "Image", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "item_qr", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Item QR Code", + "length": 0, + "mandatory_depends_on": null, + "modified": "2024-02-15 12:27:24.365547", + "module": null, + "name": "Item-custom_item_qr_code", + "no_copy": 0, + "non_negative": 0, + "options": "item_qr", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": "0", + "depends_on": "", + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Item", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "gold_weight", + "fieldtype": "Float", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "warranty_period", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Gold Weight", + "length": 0, + "mandatory_depends_on": "", + "modified": "2023-08-10 16:25:51.557590", + "module": null, + "name": "Item-gold_weight", + "no_copy": 0, + "non_negative": 0, + "options": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": null, + "depends_on": "", + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Item", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "has_stone", + "fieldtype": "Check", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "weight_uom", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Has Stone", + "length": 0, + "mandatory_depends_on": null, + "modified": "2023-08-10 16:19:51.484765", + "module": null, + "name": "Item-has_stone", + "no_copy": 0, + "non_negative": 0, + "options": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "default": "0", + "depends_on": "has_stone", + "description": null, + "docstatus": 0, + "doctype": "Custom Field", + "dt": "Item", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "stone_charge", + "fieldtype": "Currency", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_preview": 0, + "in_standard_filter": 0, + "insert_after": "stone_weight", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Stone Charge", + "length": 0, + "mandatory_depends_on": null, + "modified": "2023-08-10 16:22:43.694341", + "module": null, + "name": "Item-stone_charge", + "no_copy": 0, + "non_negative": 0, + "options": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "read_only_depends_on": null, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "show_dashboard": 0, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + } + ] \ No newline at end of file diff --git a/aumms/fixtures/designation.json b/aumms/fixtures/designation.json index bf7acce2..ff4d501c 100644 --- a/aumms/fixtures/designation.json +++ b/aumms/fixtures/designation.json @@ -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": [] - } -] \ No newline at end of file + { + "description": null, + "designation_name": "Smith", + "docstatus": 0, + "doctype": "Designation", + "modified": "2023-11-09 16:31:17.044970", + "name": "Smith" + } + ] \ No newline at end of file diff --git a/aumms/fixtures/role.json b/aumms/fixtures/role.json index dd56b48a..1d993205 100644 --- a/aumms/fixtures/role.json +++ b/aumms/fixtures/role.json @@ -1,93 +1,149 @@ [ - { - "desk_access": 1, - "disabled": 0, - "docstatus": 0, - "doctype": "Role", - "home_page": null, - "is_custom": 0, - "modified": "2024-05-07 11:57:06.425584", - "name": "Sales Manager", - "restrict_to_domain": null, - "role_name": "Sales Manager", - "two_factor_auth": 0 - }, - { - "desk_access": 1, - "disabled": 0, - "docstatus": 0, - "doctype": "Role", - "home_page": null, - "is_custom": 0, - "modified": "2024-05-03 16:59:21.456754", - "name": "Sales Officer", - "restrict_to_domain": null, - "role_name": "Sales Officer", - "two_factor_auth": 0 - }, - { - "desk_access": 1, - "disabled": 0, - "docstatus": 0, - "doctype": "Role", - "home_page": null, - "is_custom": 0, - "modified": "2023-08-09 11:52:51.350016", - "name": "Supervisor", - "restrict_to_domain": null, - "role_name": "Supervisor", - "two_factor_auth": 0 - }, - { - "desk_access": 1, - "disabled": 0, - "docstatus": 0, - "doctype": "Role", - "home_page": null, - "is_custom": 0, - "modified": "2023-08-09 12:56:39.398103", - "name": "Design Analyst", - "restrict_to_domain": null, - "role_name": "Design Analyst", - "two_factor_auth": 0 - }, - { - "desk_access": 1, - "disabled": 0, - "docstatus": 0, - "doctype": "Role", - "home_page": null, - "is_custom": 0, - "modified": "2023-10-18 15:34:02.128307", - "name": "Head of Smith", - "restrict_to_domain": null, - "role_name": "Head of Smith", - "two_factor_auth": 0 - }, - { - "desk_access": 1, - "disabled": 0, - "docstatus": 0, - "doctype": "Role", - "home_page": null, - "is_custom": 0, - "modified": "2023-10-18 16:03:05.894641", - "name": "Smith", - "restrict_to_domain": null, - "role_name": "Smith", - "two_factor_auth": 0 - }, - { - "desk_access": 1, - "disabled": 0, - "docstatus": 0, - "doctype": "Role", - "home_page": null, - "is_custom": 0, - "modified": "2024-02-01 12:22:37.829708", - "name": "AuMMS Manager", - "restrict_to_domain": null, - "role_name": "AuMMS Manager", - "two_factor_auth": 0 - } -] \ No newline at end of file + { + "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-07 11:57:06.425584", + "name": "Sales Manager", + "notifications": 1, + "restrict_to_domain": null, + "role_name": "Sales Manager", + "search_bar": 1, + "timeline": 1, + "two_factor_auth": 0, + "view_switcher": 1 + }, + { + "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, + "desk_access": 1, + "disabled": 0, + "docstatus": 0, + "doctype": "Role", + "form_sidebar": 1, + "home_page": null, + "is_custom": 0, + "list_sidebar": 1, + "modified": "2023-08-09 11:52:51.350016", + "name": "Supervisor", + "notifications": 1, + "restrict_to_domain": null, + "role_name": "Supervisor", + "search_bar": 1, + "timeline": 1, + "two_factor_auth": 0, + "view_switcher": 1 + }, + { + "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": "2023-08-09 12:56:39.398103", + "name": "Design Analyst", + "notifications": 1, + "restrict_to_domain": null, + "role_name": "Design Analyst", + "search_bar": 1, + "timeline": 1, + "two_factor_auth": 0, + "view_switcher": 1 + }, + { + "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": "2023-10-18 15:34:02.128307", + "name": "Head of Smith", + "notifications": 1, + "restrict_to_domain": null, + "role_name": "Head of Smith", + "search_bar": 1, + "timeline": 1, + "two_factor_auth": 0, + "view_switcher": 1 + }, + { + "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": "2023-10-18 16:03:05.894641", + "name": "Smith", + "notifications": 1, + "restrict_to_domain": null, + "role_name": "Smith", + "search_bar": 1, + "timeline": 1, + "two_factor_auth": 0, + "view_switcher": 1 + }, + { + "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-02-01 12:22:37.829708", + "name": "AuMMS Manager", + "notifications": 1, + "restrict_to_domain": null, + "role_name": "AuMMS Manager", + "search_bar": 1, + "timeline": 1, + "two_factor_auth": 0, + "view_switcher": 1 + } + ] \ No newline at end of file diff --git a/aumms/fixtures/workflow_action_master.json b/aumms/fixtures/workflow_action_master.json index 6a8ba254..858843ca 100644 --- a/aumms/fixtures/workflow_action_master.json +++ b/aumms/fixtures/workflow_action_master.json @@ -1,44 +1,39 @@ + [ - { - "docstatus": 0, - "doctype": "Workflow Action Master", - "modified": "2024-10-21 16:21:30.096728", - "name": "Review", - "workflow_action_name": "Review" - }, - { - "docstatus": 0, - "doctype": "Workflow Action Master", - "modified": "2024-02-03 10:34:51.940832", - "name": "Approve", - "workflow_action_name": "Approve" - }, - { - "docstatus": 0, - "doctype": "Workflow Action Master", - "modified": "2024-02-03 10:34:51.942167", - "name": "Reject", - "workflow_action_name": "Reject" - }, - { - "docstatus": 0, - "doctype": "Workflow Action Master", - "modified": "2024-04-02 10:46:16.390196", - "name": "Submit", - "workflow_action_name": "Submit" - }, - { - "docstatus": 0, - "doctype": "Workflow Action Master", - "modified": "2024-04-02 10:47:10.321135", - "name": "Submit for Feasibility check", - "workflow_action_name": "Submit for Feasibility check" - }, - { - "docstatus": 0, - "doctype": "Workflow Action Master", - "modified": "2024-04-03 11:40:05.185475", - "name": "Cancel", - "workflow_action_name": "Cancel" - } -] \ No newline at end of file + { + "docstatus": 0, + "doctype": "Workflow Action Master", + "modified": "2024-02-03 10:34:51.940832", + "name": "Approve", + "workflow_action_name": "Approve" + }, + { + "docstatus": 0, + "doctype": "Workflow Action Master", + "modified": "2024-02-03 10:34:51.942167", + "name": "Reject", + "workflow_action_name": "Reject" + }, + { + "docstatus": 0, + "doctype": "Workflow Action Master", + "modified": "2024-04-02 10:46:16.390196", + "name": "Submit", + "workflow_action_name": "Submit" + }, + { + "docstatus": 0, + "doctype": "Workflow Action Master", + "modified": "2024-04-02 10:47:10.321135", + "name": "Submit for Feasibility check", + "workflow_action_name": "Submit for Feasibility check" + }, + { + "docstatus": 0, + "doctype": "Workflow Action Master", + "modified": "2024-04-03 11:40:05.185475", + "name": "Cancel", + "workflow_action_name": "Cancel" + } + ] + \ No newline at end of file From b9be4f8b78695337b8582f05eedafcc831a0eaf3 Mon Sep 17 00:00:00 2001 From: ajmalroshan123 Date: Mon, 11 Nov 2024 13:16:57 +0530 Subject: [PATCH 13/15] fix: Corrected the code --- aumms/hooks.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/aumms/hooks.py b/aumms/hooks.py index 385907b6..c28f91ea 100644 --- a/aumms/hooks.py +++ b/aumms/hooks.py @@ -107,15 +107,15 @@ }, { "dt":"Workflow", - "filters":[["name","in",["Feasibility check", "Touch Validation Workflow", "Purchase Receipt Workflow","Hallmark Request Workflow"]]] + "filters":[["name","in",["Feasibility check"]]] }, { "dt":"Workflow Action Master", - "filters":[["name","in",["Send for Hallmarking", "Hallmark Items Return", "Submit for Feasibility check", "Approve", "Reject", "Submit", "Cancel", "Review"]]] + "filters":[["name","in",["Submit for Feasibility check", "Approve", "Reject", "Submit", "Cancel"]]] }, { "dt":"Workflow State", - "filters":[["name","in",["Draft", "Submitted", "Sent for Hallmarking", "Send for Hallmarking", "Items Hallmarked", "Submitted for feasibility", "Feasible", "Not Feasible", "Submitted", "Cancelled", "Manager Approved", "Manager Rejected", "Director Approved", "Director Rejected", "Sent to Director", "Sent to Manager"]]] + "filters":[["name","in",["Draft", "Submitted for feasibility", "Feasible", "Not Feasible", "Submitted", "Cancelled"]]] }, { "dt":"Custom Field", From 1ed61b3a35f1feb69cfb8f952696d7e7ac986738 Mon Sep 17 00:00:00 2001 From: ajmalroshan123 Date: Mon, 11 Nov 2024 14:44:59 +0530 Subject: [PATCH 14/15] feat: addded custom field in sales order --- aumms/setup.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/aumms/setup.py b/aumms/setup.py index 1b63f269..c40c9047 100644 --- a/aumms/setup.py +++ b/aumms/setup.py @@ -10,6 +10,7 @@ def after_install(): create_custom_fields(get_purchase_receipt_custom_fields(), ignore_validate=True) create_custom_fields(get_sales_invoice_custom_fields(), ignore_validate=True) create_custom_fields(get_jewellery_invoice_custom_fields(), ignore_validate=True) + create_custom_fields(get_sales_order_custom_fields(), ignore_validate=True) def after_migrate(): after_install() @@ -205,3 +206,23 @@ def get_jewellery_invoice_custom_fields(): } ] } + + + +def get_sales_order_custom_fields(): + ''' + Custom fields that need to be added to the Sales Order Doctype + ''' + return { + "Sales Order": [ + + ], + "Sales Order Item": [ + { + "fieldname": "board_rate", + "fieldtype": "Data", + "label": "Board Rate", + "insert_after": "amount" + } + ] + } \ No newline at end of file From 55251bed667c92b38dd01b526754fbe3352b2776 Mon Sep 17 00:00:00 2001 From: ajmalroshan123 Date: Wed, 13 Nov 2024 12:55:41 +0530 Subject: [PATCH 15/15] fix: Corrected the autonaming and creating the aumms item --- .../jewellery_receipt/jewellery_receipt.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/aumms/aumms/doctype/jewellery_receipt/jewellery_receipt.py b/aumms/aumms/doctype/jewellery_receipt/jewellery_receipt.py index 88621697..5c4d7b80 100644 --- a/aumms/aumms/doctype/jewellery_receipt/jewellery_receipt.py +++ b/aumms/aumms/doctype/jewellery_receipt/jewellery_receipt.py @@ -1,7 +1,6 @@ import frappe from frappe.model.document import Document - class JewelleryReceipt(Document): def autoname(self): @@ -13,7 +12,8 @@ def autoname(self): if item_detail.has_stone: for stone in self.item_wise_stone_details: - item_code_parts.append(stone.stone) + if stone.reference == item_detail.idx: + item_code_parts.append(stone.stone) item_detail.item_code = ' '.join(item_code_parts) @@ -52,14 +52,16 @@ def create_item(self): aumms_item.hallmarked = 1 aumms_item.huid = item_detail.huid + # Add only the relevant stone details based on the reference if item_detail.has_stone: for stone in self.item_wise_stone_details: - aumms_item.append("stone_details", { - "stone_weight": stone.stone_weight, - "stone_charge": stone.rate * stone.stone_weight, - "item_name": stone.stone, - "stone_type": stone.stone - }) + if stone.reference == item_detail.idx: + aumms_item.append("stone_details", { + "stone_weight": stone.stone_weight, + "stone_charge": stone.rate * stone.stone_weight, + "item_name": stone.stone, + "stone_type": stone.stone + }) aumms_item.insert(ignore_permissions=True) frappe.msgprint('AuMMS Item Created.', indicator="green", alert=1)