From 9440e5a6f98d1afec3d3e478fe1682ddd0509a74 Mon Sep 17 00:00:00 2001 From: Keerthana-ck Date: Fri, 9 Feb 2024 00:24:34 +0530 Subject: [PATCH 1/2] Feat : Added Child Table Sales Taxes and Charges in Jewellery Invoice --- aumms/aumms/custom/jewellery_invoice.json | 445 ++++++++++++++++++ .../jewellery_invoice/jewellery_invoice.js | 48 +- .../jewellery_invoice/jewellery_invoice.py | 53 ++- 3 files changed, 531 insertions(+), 15 deletions(-) create mode 100644 aumms/aumms/custom/jewellery_invoice.json diff --git a/aumms/aumms/custom/jewellery_invoice.json b/aumms/aumms/custom/jewellery_invoice.json new file mode 100644 index 00000000..c9afc165 --- /dev/null +++ b/aumms/aumms/custom/jewellery_invoice.json @@ -0,0 +1,445 @@ +{ + "custom_fields": [ + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "creation": "2024-02-07 22:15:11.742343", + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "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, + "idx": 27, + "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", + "modified_by": "Administrator", + "module": null, + "name": "Jewellery Invoice-custom_total_taxes_and_charges", + "no_copy": 0, + "non_negative": 0, + "options": "currency", + "owner": "Administrator", + "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, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "creation": "2024-02-07 22:15:11.516402", + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "dt": "Jewellery Invoice", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "custom_column_break_1zplm", + "fieldtype": "Column Break", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "idx": 26, + "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_total_taxes_and_charges_company_currency", + "is_system_generated": 0, + "is_virtual": 0, + "label": null, + "length": 0, + "mandatory_depends_on": null, + "modified": "2024-02-07 22:15:11.516402", + "modified_by": "Administrator", + "module": null, + "name": "Jewellery Invoice-custom_column_break_1zplm", + "no_copy": 0, + "non_negative": 0, + "options": null, + "owner": "Administrator", + "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, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "creation": "2024-02-07 22:15:11.279549", + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "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, + "idx": 25, + "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", + "modified_by": "Administrator", + "module": null, + "name": "Jewellery Invoice-custom_total_taxes_and_charges_company_currency", + "no_copy": 0, + "non_negative": 0, + "options": "Company:company:default_currency", + "owner": "Administrator", + "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, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "creation": "2024-02-07 22:15:11.180348", + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "dt": "Jewellery Invoice", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "custom_section_break_qv4uh", + "fieldtype": "Section Break", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "idx": 24, + "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_sales_taxes_and_charges", + "is_system_generated": 0, + "is_virtual": 0, + "label": null, + "length": 0, + "mandatory_depends_on": null, + "modified": "2024-02-07 22:15:11.180348", + "modified_by": "Administrator", + "module": null, + "name": "Jewellery Invoice-custom_section_break_qv4uh", + "no_copy": 0, + "non_negative": 0, + "options": null, + "owner": "Administrator", + "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, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "creation": "2024-02-07 22:15:11.034978", + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "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, + "idx": 23, + "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", + "modified_by": "Administrator", + "module": null, + "name": "Jewellery Invoice-custom_sales_taxes_and_charges", + "no_copy": 0, + "non_negative": 0, + "options": "Sales Taxes and Charges", + "owner": "Administrator", + "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, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "creation": "2024-02-07 22:15:10.690293", + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "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, + "idx": 21, + "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", + "modified_by": "Administrator", + "module": null, + "name": "Jewellery Invoice-custom_taxes_and_charges", + "no_copy": 0, + "non_negative": 0, + "options": null, + "owner": "Administrator", + "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, + "sort_options": 0, + "translatable": 0, + "unique": 0, + "width": null + } + ], + "custom_perms": [], + "doctype": "Jewellery Invoice", + "links": [], + "property_setters": [ + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2024-02-07 22:16:15.199636", + "default_value": null, + "doc_type": "Jewellery Invoice", + "docstatus": 0, + "doctype_or_field": "DocType", + "field_name": null, + "idx": 0, + "is_system_generated": 0, + "modified": "2024-02-07 22:16:15.199636", + "modified_by": "Administrator", + "module": null, + "name": "Jewellery Invoice-main-field_order", + "owner": "Administrator", + "property": "field_order", + "property_type": "Data", + "row_name": null, + "value": "[\"customer\", \"customer_name\", \"transaction_type\", \"company\", \"column_break_pogd4\", \"transaction_date\", \"delivery_date\", \"naming_series\", \"status\", \"column_break_8fcvh\", \"old_jewellery_items\", \"items_section\", \"items\", \"section_break_ypbyf\", \"total_old_gold_weight\", \"total_gold_weight\", \"balance_amount\", \"column_break_mzcap\", \"total_old_gold_amount\", \"total_gold_amount\", \"custom_taxes_and_charges\", \"sales_taxes_and_charges_template\", \"custom_sales_taxes_and_charges\", \"custom_section_break_qv4uh\", \"custom_total_taxes_and_charges_company_currency\", \"custom_column_break_1zplm\", \"custom_total_taxes_and_charges\", \"totals_section\", \"currency\", \"grand_total\", \"rounding_adjustment\", \"rounded_total\", \"disable_rounded_total\", \"column_break_omoat\", \"paid_amount\", \"outstanding_amount\", \"in_words\", \"advances_tab\", \"customer_advances\", \"section_break_y6lif\", \"total_advance_received\", \"total_qty_obtained\", \"column_break_yqyhw\", \"purity\", \"uom\", \"more_tab\", \"amended_from\", \"sales_order\", \"sales_invoice\", \"column_break_3nmwo\", \"delivered\", \"delivery_note\", \"purchase_receipt\", \"purchase_invoice\"]" + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2024-02-07 21:56:17.342636", + "default_value": null, + "doc_type": "Jewellery Invoice", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "naming_series", + "idx": 0, + "is_system_generated": 0, + "modified": "2024-02-07 21:56:17.342636", + "modified_by": "Administrator", + "module": null, + "name": "Jewellery Invoice-naming_series-default", + "owner": "Administrator", + "property": "default", + "property_type": "Text", + "row_name": null, + "value": "INV-.YYYY.-" + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2024-02-07 21:56:17.312080", + "default_value": null, + "doc_type": "Jewellery Invoice", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "naming_series", + "idx": 0, + "is_system_generated": 0, + "modified": "2024-02-07 21:56:17.312080", + "modified_by": "Administrator", + "module": null, + "name": "Jewellery Invoice-naming_series-options", + "owner": "Administrator", + "property": "options", + "property_type": "Text", + "row_name": null, + "value": "INV-.YYYY.-" + } + ], + "sync_on_migrate": 1 +} \ No newline at end of file diff --git a/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.js b/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.js index 32df5e76..7b442cd9 100644 --- a/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.js +++ b/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.js @@ -60,7 +60,40 @@ frappe.ui.form.on('Jewellery Invoice', { }, transaction_type: function(frm){ set_net_weight_and_amount(frm); - } + }, + sales_taxes_and_charges_template: function(frm) { + if (frm.doc.sales_taxes_and_charges_template) { + frappe.call({ + method: 'aumms.aumms.doctype.jewellery_invoice.jewellery_invoice.get_sales_taxes_and_charges_details', + args: { + sales_taxes_and_charges_template: frm.doc.sales_taxes_and_charges_template, + total_gold_amount : frm.doc.total_gold_amount, + jewellery_invoice: frm.doc.name + }, + callback: function(response) { + if (response.message) { + frm.clear_table("custom_sales_taxes_and_charges"); + var total_taxes_and_charges = 0 + response.message.forEach(function(tax) { + frm.add_child("custom_sales_taxes_and_charges", { + charge_type: tax.charge_type, + account_head: tax.account_head, + description: tax.description, + rate: tax.rate, + tax_amount: tax.tax_amount, + included_in_print_rate: tax.included_in_print_rate, + total : tax.total + }); + total_taxes_and_charges += tax.tax_amount + }); + frm.set_value('custom_total_taxes_and_charges', total_taxes_and_charges) + frm.refresh_field('custom_total_taxes_and_charges'); + frm.refresh_field("custom_sales_taxes_and_charges"); + } + } + }); + } +} }); frappe.ui.form.on('Old Jewellery Item', { @@ -273,7 +306,7 @@ frappe.ui.form.on('Jewellery Invoice Item', { set_totals(frm); set_net_weight_and_amount(frm); } -}) +}); let set_item_details = function(frm, child) { //function to get item get_item_details @@ -415,12 +448,20 @@ let create_custom_buttons = function(frm){ frappe.call('aumms.aumms.doctype.jewellery_invoice.jewellery_invoice.create_sales_invoice', { source_name: frm.doc.sales_order, jewellery_invoice: frm.doc.name, - sales_taxes_and_charges_template : frm.doc.sales_taxes_and_charges_template + sales_taxes_and_charges_template : frm.doc.sales_taxes_and_charges_template, + keep_metal_ledger : 1 }).then(r => { frm.reload_doc(); }); }, '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', () => { @@ -441,6 +482,7 @@ let create_custom_buttons = function(frm){ jewellery_invoice: frm.doc.name, sales_taxes_and_charges_template : frm.doc.sales_taxes_and_charges_template, update_stock: 1, + keep_metal_ledger :1 }).then(r => { frm.reload_doc(); });; diff --git a/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.py b/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.py index b85ba807..6688bad3 100644 --- a/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.py +++ b/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.py @@ -293,7 +293,7 @@ def create_payment_entry(mode_of_payment, amount, docname, posting_date=None, re return True @frappe.whitelist() -def create_sales_invoice(source_name, jewellery_invoice, sales_taxes_and_charges_template, update_stock=0, target_doc=None): +def create_sales_invoice(source_name, jewellery_invoice, sales_taxes_and_charges_template, keep_metal_ledger = 0, update_stock=0, target_doc=None): ''' Method to create Sales Invoice from Jewellery Invoice with Sales Order reference ''' def postprocess(source, target): set_missing_values(source, target) @@ -317,18 +317,19 @@ def set_missing_values(source, target): target.allocate_advances_automatically = 1 target.update_stock = update_stock target.taxes_and_charges = sales_taxes_and_charges_template + target.keep_metal_ledger = 1 # Fetch Sales Taxes and Charges Template details and set them in Sales Invoice - taxes_and_charges_details = frappe.get_doc("Sales Taxes and Charges Template", sales_taxes_and_charges_template) - for tax in taxes_and_charges_details.taxes: - target.append("taxes", { - "charge_type": tax.charge_type, - "account_head": tax.account_head, - "description": tax.description, - "rate": tax.rate, - "tax_amount": tax.tax_amount, - "included_in_print_rate": tax.included_in_print_rate - }) + # taxes_and_charges_details = frappe.get_doc("Sales Taxes and Charges Template", sales_taxes_and_charges_template) + # for tax in taxes_and_charges_details.taxes: + # target.append("taxes", { + # "charge_type": tax.charge_type, + # "account_head": tax.account_head, + # "description": tax.description, + # "rate": tax.rate, + # "tax_amount": tax.tax_amount, + # "included_in_print_rate": tax.included_in_print_rate + # }) def update_item(source, target, source_parent): target.amount = flt(source.amount) - flt(source.billed_amt) @@ -386,7 +387,8 @@ def update_item(source, target, source_parent): doclist.set_payment_schedule() doclist.set_onload("ignore_price_list", True) - doclist.save(ignore_permissions = True) + doclist.save(ignore_permissions=True) + doclist.submit() if doclist: frappe.db.set_value('Jewellery Invoice', jewellery_invoice, 'sales_invoice', doclist.name) if update_stock: @@ -459,3 +461,30 @@ def update_item(source_doc, target_doc, source_parent): frappe.db.commit() frappe.msgprint(('Delivery Note created'), indicator="green", alert=1) return True + +@frappe.whitelist() +def get_sales_taxes_and_charges_details(sales_taxes_and_charges_template, total_gold_amount, jewellery_invoice): + custom_sales_taxes_and_charges = [] + total_taxes_and_charges = 0 + total_gold_amount = float(total_gold_amount) + cumulative_total = total_gold_amount + + if sales_taxes_and_charges_template and frappe.db.exists('Sales Taxes and Charges Template', sales_taxes_and_charges_template): + taxes_and_charges_details = frappe.get_doc('Sales Taxes and Charges Template', sales_taxes_and_charges_template) + for tax in taxes_and_charges_details.taxes: + tax_amount = round((tax.rate / 100) * total_gold_amount, 2) # rounding tax_amount to 2 decimal places + total_amount = total_gold_amount + tax_amount + cumulative_total += tax_amount + custom_sales_taxes_and_charges.append({ + "charge_type": tax.charge_type, + "account_head": tax.account_head, + "description": tax.description, + "rate": tax.rate, + "tax_amount": tax_amount, + "included_in_print_rate": tax.included_in_print_rate, + "total": round(cumulative_total, 2) + }) + + total_taxes_and_charges += tax_amount + + return custom_sales_taxes_and_charges From 670ae1785cbee85442d3611bb04729baf7b6b054 Mon Sep 17 00:00:00 2001 From: Keerthana-ck Date: Fri, 9 Feb 2024 01:08:26 +0530 Subject: [PATCH 2/2] feat : add Child table Sales Taxes and Charges in Sales Order --- .../jewellery_invoice/jewellery_invoice.py | 66 +++++++++++-------- 1 file changed, 38 insertions(+), 28 deletions(-) diff --git a/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.py b/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.py index 6688bad3..7e3e6832 100644 --- a/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.py +++ b/aumms/aumms/doctype/jewellery_invoice/jewellery_invoice.py @@ -21,7 +21,7 @@ def validate(self): def on_submit(self): ''' Method to Create Sales Order & Purchase Order and link them with Jewellery Invoice ''' if self.transaction_type in ['Sales', 'Exchange']: - sales_order = create_sales_order(self.name) + sales_order = create_sales_order(self.name, self.sales_taxes_and_charges_template) if sales_order: frappe.db.set_value(self.doctype, self.name, 'sales_order', sales_order) frappe.db.set_value(self.doctype, self.name, 'status', 'Ordered') @@ -121,33 +121,43 @@ def cancel_delivery_note(self): else: frappe.throw('Delivery Note `{0}` not found!'.format(self.delivery_note)) -def create_sales_order(source_name, target_doc=None): - ''' Method to create Sales Order from Jewellery Invoice ''' - def set_missing_values(source, target): - keep_metal_ledger = 0 - transaction_type = frappe.db.get_value('Jewellery Invoice', source_name, 'transaction_type') - if transaction_type in ['Purchase', 'Exchange']: - keep_metal_ledger = 1 - target.keep_metal_ledger = keep_metal_ledger - target_doc = get_mapped_doc("Jewellery Invoice", source_name, - { - "Jewellery Invoice": { - "doctype": "Sales Order", - "field_map":{ - }, - }, - "Jewellery Invoice Item": { - "doctype": "Sales Order Item", - "field_map": { - 'delivery_date':'delivery_date', - 'gold_weight':'qty', - }, - }, - }, target_doc, set_missing_values) - target_doc.submit() - frappe.msgprint(('Sales Order created'), indicator="green", alert=1) - frappe.db.commit() - return target_doc.name +def create_sales_order(source_name, sales_taxes_and_charges_template , target_doc=None): + ''' Method to create Sales Order from Jewellery Invoice ''' + def set_missing_values(source, target): + keep_metal_ledger = 0 + transaction_type = frappe.db.get_value('Jewellery Invoice', source_name, 'transaction_type') + if transaction_type in ['Purchase', 'Exchange']: + keep_metal_ledger = 1 + target.keep_metal_ledger = keep_metal_ledger + taxes_and_charges_details = frappe.get_doc("Sales Taxes and Charges Template", sales_taxes_and_charges_template) + for tax in taxes_and_charges_details.taxes: + target.append("taxes", { + "charge_type": tax.charge_type, + "account_head": tax.account_head, + "description": tax.description, + "rate": tax.rate, + "tax_amount": tax.tax_amount, + "included_in_print_rate": tax.included_in_print_rate + }) + target_doc = get_mapped_doc("Jewellery Invoice", source_name, + { + "Jewellery Invoice": { + "doctype": "Sales Order", + "field_map": { + }, + }, + "Jewellery Invoice Item": { + "doctype": "Sales Order Item", + "field_map": { + 'delivery_date': 'delivery_date', + 'gold_weight': 'qty', + }, + }, + }, target_doc, set_missing_values) + target_doc.submit() + frappe.msgprint(('Sales Order created'), indicator="green", alert=1) + frappe.db.commit() + return target_doc.name def get_party_link_if_exist(party_type, party): ''' Method to get Common Party Link if exists '''