From ddf0f548dcbde1882372bb451565f5eaaf3c91c7 Mon Sep 17 00:00:00 2001 From: pragatid20 Date: Mon, 23 Dec 2024 14:35:43 +0530 Subject: [PATCH] |nirjay_customization|added new doctype multi purchase order and childtable for multiple purchase order| --- .../custom/purchase_invoice.json | 376 +++++++++++++++--- .../nirjay_customization/doctype/__init__.py | 0 .../doctype/multi_purchase_order/__init__.py | 0 .../multi_purchase_order.js | 137 +++++++ .../multi_purchase_order.json | 117 ++++++ .../multi_purchase_order.py | 9 + .../test_multi_purchase_order.py | 30 ++ .../purchase_order_item_ct/__init__.py | 0 .../purchase_order_item_ct.json | 60 +++ .../purchase_order_item_ct.py | 9 + .../override/purchase_invoice.py | 32 ++ 11 files changed, 710 insertions(+), 60 deletions(-) create mode 100644 nirjay_customization/nirjay_customization/doctype/__init__.py create mode 100644 nirjay_customization/nirjay_customization/doctype/multi_purchase_order/__init__.py create mode 100644 nirjay_customization/nirjay_customization/doctype/multi_purchase_order/multi_purchase_order.js create mode 100644 nirjay_customization/nirjay_customization/doctype/multi_purchase_order/multi_purchase_order.json create mode 100644 nirjay_customization/nirjay_customization/doctype/multi_purchase_order/multi_purchase_order.py create mode 100644 nirjay_customization/nirjay_customization/doctype/multi_purchase_order/test_multi_purchase_order.py create mode 100644 nirjay_customization/nirjay_customization/doctype/purchase_order_item_ct/__init__.py create mode 100644 nirjay_customization/nirjay_customization/doctype/purchase_order_item_ct/purchase_order_item_ct.json create mode 100644 nirjay_customization/nirjay_customization/doctype/purchase_order_item_ct/purchase_order_item_ct.py create mode 100644 nirjay_customization/override/purchase_invoice.py diff --git a/nirjay_customization/nirjay_customization/custom/purchase_invoice.json b/nirjay_customization/nirjay_customization/custom/purchase_invoice.json index cf3beca..e1c3dab 100644 --- a/nirjay_customization/nirjay_customization/custom/purchase_invoice.json +++ b/nirjay_customization/nirjay_customization/custom/purchase_invoice.json @@ -39,7 +39,7 @@ "length": 0, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-11-24 17:29:58.503542", + "modified": "2024-12-09 13:10:55.608819", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-company_gstin", @@ -89,7 +89,7 @@ "hide_border": 0, "hide_days": 0, "hide_seconds": 0, - "idx": 8, + "idx": 9, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_global_search": 0, @@ -128,6 +128,70 @@ "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-12-23 13:51:14.346480", + "default": null, + "depends_on": "eval:doc.custom_is_expense && doc.custom_multi_po\n", + "description": null, + "docstatus": 0, + "dt": "Purchase Invoice", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "custom_expense_against_multi_purchase_order", + "fieldtype": "Link", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "idx": 19, + "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_expense_against_purchase_order", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Expense Against Multi Purchase Order", + "length": 0, + "link_filters": null, + "mandatory_depends_on": "eval:doc.custom_is_expense && doc.custom_multi_po\n", + "modified": "2024-12-23 13:51:14.346480", + "modified_by": "Administrator", + "module": null, + "name": "Purchase Invoice-custom_expense_against_multi_purchase_order", + "no_copy": 0, + "non_negative": 0, + "options": "Multi Purchase Order", + "owner": "Administrator", + "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 + }, { "_assign": null, "_comments": null, @@ -141,7 +205,7 @@ "columns": 0, "creation": "2024-08-09 03:08:10.590057", "default": null, - "depends_on": "eval:doc.custom_is_expense", + "depends_on": "eval:doc.custom_is_expense && !doc.custom_multi_po\n", "description": null, "docstatus": 0, "dt": "Purchase Invoice", @@ -153,7 +217,7 @@ "hide_border": 0, "hide_days": 0, "hide_seconds": 0, - "idx": 17, + "idx": 18, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_global_search": 0, @@ -166,7 +230,7 @@ "label": "Expense Against Purchase Order", "length": 0, "link_filters": null, - "mandatory_depends_on": "eval:doc.custom_is_expense", + "mandatory_depends_on": "eval:doc.custom_is_expense && !doc.custom_multi_po\n", "modified": "2024-08-07 19:51:59.539703", "modified_by": "Administrator", "module": null, @@ -192,6 +256,70 @@ "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-12-23 14:01:55.307702", + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "dt": "Purchase Invoice", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "custom_is_common", + "fieldtype": "Check", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "idx": 20, + "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_expense_against_multi_purchase_order", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Is Common", + "length": 0, + "link_filters": null, + "mandatory_depends_on": null, + "modified": "2024-12-23 14:01:55.307702", + "modified_by": "Administrator", + "module": null, + "name": "Purchase Invoice-custom_is_common", + "no_copy": 0, + "non_negative": 0, + "options": null, + "owner": "Administrator", + "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 + }, { "_assign": null, "_comments": null, @@ -217,7 +345,7 @@ "hide_border": 0, "hide_days": 0, "hide_seconds": 0, - "idx": 16, + "idx": 17, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_global_search": 0, @@ -256,6 +384,134 @@ "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-12-23 13:45:57.037769", + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "dt": "Purchase Invoice", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "custom_multi_po", + "fieldtype": "Check", + "hidden": 0, + "hide_border": 0, + "hide_days": 0, + "hide_seconds": 0, + "idx": 1, + "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": null, + "is_system_generated": 0, + "is_virtual": 0, + "label": "Multi PO", + "length": 0, + "link_filters": null, + "mandatory_depends_on": null, + "modified": "2024-12-23 13:45:57.037769", + "modified_by": "Administrator", + "module": null, + "name": "Purchase Invoice-custom_multi_po", + "no_copy": 0, + "non_negative": 0, + "options": null, + "owner": "Administrator", + "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 + }, + { + "_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-12-23 14:15:08.368229", + "default": null, + "depends_on": "eval:doc.custom_is_common && doc.custom_multi_po\n", + "description": null, + "docstatus": 0, + "dt": "Purchase Invoice", + "fetch_from": null, + "fetch_if_empty": 0, + "fieldname": "custom_multi_purchase_order", + "fieldtype": "Link", + "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": "custom_is_common", + "is_system_generated": 0, + "is_virtual": 0, + "label": "Multi Purchase Order", + "length": 0, + "link_filters": null, + "mandatory_depends_on": "eval:doc.custom_is_common && doc.custom_multi_po\n", + "modified": "2024-12-23 14:15:08.368229", + "modified_by": "Administrator", + "module": null, + "name": "Purchase Invoice-custom_multi_purchase_order", + "no_copy": 0, + "non_negative": 0, + "options": "Multi Purchase Order", + "owner": "Administrator", + "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 + }, { "_assign": null, "_comments": null, @@ -281,7 +537,7 @@ "hide_border": 0, "hide_days": 0, "hide_seconds": 0, - "idx": 9, + "idx": 10, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_global_search": 0, @@ -345,7 +601,7 @@ "hide_border": 0, "hide_days": 0, "hide_seconds": 0, - "idx": 10, + "idx": 11, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_global_search": 0, @@ -423,7 +679,7 @@ "length": 0, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-11-24 17:30:13.752332", + "modified": "2024-12-09 13:11:05.005199", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-distance", @@ -487,7 +743,7 @@ "length": 0, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-11-24 17:30:13.372775", + "modified": "2024-12-09 13:11:04.638108", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-driver", @@ -551,7 +807,7 @@ "length": 0, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-11-24 17:30:13.642906", + "modified": "2024-12-09 13:11:04.937743", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-driver_name", @@ -615,7 +871,7 @@ "length": 0, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-11-24 17:30:13.959754", + "modified": "2024-12-09 13:11:05.128830", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-ewaybill", @@ -679,7 +935,7 @@ "length": 0, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-11-24 17:29:58.756532", + "modified": "2024-12-09 13:10:55.757024", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-gst_breakup_table", @@ -743,7 +999,7 @@ "length": 0, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-11-24 17:29:58.450909", + "modified": "2024-12-09 13:10:55.570438", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-gst_category", @@ -807,7 +1063,7 @@ "length": 0, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-11-24 17:30:12.995058", + "modified": "2024-12-09 13:11:04.378582", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-gst_col_break", @@ -871,7 +1127,7 @@ "length": 0, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-11-24 17:30:12.674736", + "modified": "2024-12-09 13:11:04.256187", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-gst_section", @@ -935,7 +1191,7 @@ "length": 0, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-11-24 17:30:13.804291", + "modified": "2024-12-09 13:11:05.037065", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-gst_transporter_id", @@ -999,7 +1255,7 @@ "length": 0, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-11-24 17:30:13.909825", + "modified": "2024-12-09 13:11:05.098334", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-gst_vehicle_type", @@ -1063,7 +1319,7 @@ "length": 0, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-11-24 17:30:12.836485", + "modified": "2024-12-09 13:11:04.317833", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-ineligibility_reason", @@ -1127,7 +1383,7 @@ "length": 0, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-11-24 17:29:58.629241", + "modified": "2024-12-09 13:10:55.681702", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-is_reverse_charge", @@ -1191,7 +1447,7 @@ "length": 0, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-11-24 17:30:13.105541", + "modified": "2024-12-09 13:11:04.445572", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-itc_central_tax", @@ -1255,7 +1511,7 @@ "length": 0, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-11-24 17:30:13.209343", + "modified": "2024-12-09 13:11:04.509702", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-itc_cess_amount", @@ -1319,7 +1575,7 @@ "length": 0, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-11-24 17:30:12.749468", + "modified": "2024-12-09 13:11:04.287247", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-itc_classification", @@ -1383,7 +1639,7 @@ "length": 0, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-11-24 17:30:13.053617", + "modified": "2024-12-09 13:11:04.411235", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-itc_integrated_tax", @@ -1447,7 +1703,7 @@ "length": 0, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-11-24 17:30:13.156534", + "modified": "2024-12-09 13:11:04.478606", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-itc_state_tax", @@ -1511,7 +1767,7 @@ "length": 0, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-11-24 17:30:13.696890", + "modified": "2024-12-09 13:11:04.972308", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-lr_date", @@ -1575,7 +1831,7 @@ "length": 30, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-11-24 17:30:13.429797", + "modified": "2024-12-09 13:11:04.681374", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-lr_no", @@ -1639,7 +1895,7 @@ "length": 0, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-11-24 17:30:13.856760", + "modified": "2024-12-09 13:11:05.067332", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-mode_of_transport", @@ -1703,7 +1959,7 @@ "length": 0, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-11-24 17:29:58.564935", + "modified": "2024-12-09 13:10:55.647376", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-place_of_supply", @@ -1767,7 +2023,7 @@ "length": 0, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-11-24 17:30:12.914184", + "modified": "2024-12-09 13:11:04.348176", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-reconciliation_status", @@ -1831,7 +2087,7 @@ "length": 0, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-11-24 17:29:58.696489", + "modified": "2024-12-09 13:10:55.722355", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-section_gst_breakup", @@ -1895,7 +2151,7 @@ "length": 0, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-11-24 17:29:58.389871", + "modified": "2024-12-09 13:10:55.529066", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-supplier_gstin", @@ -1959,7 +2215,7 @@ "length": 0, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-11-24 17:30:13.316996", + "modified": "2024-12-09 13:11:04.597910", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-transporter", @@ -2023,7 +2279,7 @@ "length": 0, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-11-24 17:30:13.537246", + "modified": "2024-12-09 13:11:04.833747", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-transporter_col_break", @@ -2087,7 +2343,7 @@ "length": 0, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-11-24 17:30:13.263225", + "modified": "2024-12-09 13:11:04.557957", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-transporter_info", @@ -2151,7 +2407,7 @@ "length": 0, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-11-24 17:30:13.589934", + "modified": "2024-12-09 13:11:04.896359", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-transporter_name", @@ -2215,7 +2471,7 @@ "length": 15, "link_filters": null, "mandatory_depends_on": null, - "modified": "2024-11-24 17:30:13.485640", + "modified": "2024-12-09 13:11:04.721495", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-vehicle_no", @@ -2258,7 +2514,7 @@ "field_name": "base_rounded_total", "idx": 0, "is_system_generated": 0, - "modified": "2024-04-18 17:39:16.240205", + "modified": "2024-12-04 17:23:12.584714", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-base_rounded_total-hidden", @@ -2281,7 +2537,7 @@ "field_name": "base_rounded_total", "idx": 0, "is_system_generated": 0, - "modified": "2024-04-18 17:39:16.259726", + "modified": "2024-12-04 17:23:12.596889", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-base_rounded_total-print_hide", @@ -2296,7 +2552,7 @@ "_comments": null, "_liked_by": null, "_user_tags": null, - "creation": "2024-11-24 17:30:37.596657", + "creation": "2024-12-09 13:11:21.618695", "default_value": null, "doc_type": "Purchase Invoice", "docstatus": 0, @@ -2304,7 +2560,7 @@ "field_name": "bill_no", "idx": 0, "is_system_generated": 1, - "modified": "2024-11-24 17:30:37.596657", + "modified": "2024-12-09 13:11:21.618695", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-bill_no-mandatory_depends_on", @@ -2327,7 +2583,7 @@ "field_name": "disable_rounded_total", "idx": 0, "is_system_generated": 0, - "modified": "2024-04-18 17:39:16.296076", + "modified": "2024-12-04 17:23:12.623604", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-disable_rounded_total-default", @@ -2350,7 +2606,7 @@ "field_name": "due_date", "idx": 0, "is_system_generated": 0, - "modified": "2024-04-17 19:11:51.564178", + "modified": "2024-12-04 17:23:12.636345", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-due_date-print_hide", @@ -2373,7 +2629,7 @@ "field_name": "in_words", "idx": 0, "is_system_generated": 0, - "modified": "2024-04-18 17:39:16.481941", + "modified": "2024-12-04 17:23:12.647607", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-in_words-hidden", @@ -2396,7 +2652,7 @@ "field_name": "in_words", "idx": 0, "is_system_generated": 0, - "modified": "2024-04-18 17:39:16.491846", + "modified": "2024-12-04 17:23:12.658862", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-in_words-print_hide", @@ -2411,7 +2667,7 @@ "_comments": null, "_liked_by": null, "_user_tags": null, - "creation": "2024-08-08 01:26:11.089344", + "creation": "2024-12-23 14:15:09.805288", "default_value": null, "doc_type": "Purchase Invoice", "docstatus": 0, @@ -2419,7 +2675,7 @@ "field_name": null, "idx": 0, "is_system_generated": 0, - "modified": "2024-08-08 01:26:11.089344", + "modified": "2024-12-23 14:15:09.805288", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-main-field_order", @@ -2427,7 +2683,7 @@ "property": "field_order", "property_type": "Data", "row_name": null, - "value": "[\"title\", \"naming_series\", \"supplier\", \"supplier_name\", \"ewaybill\", \"tax_id\", \"company\", \"custom_bill_of_lading_attachment\", \"custom_original_invoice_copy\", \"custom_packing_list_attachment\", \"column_break_6\", \"posting_date\", \"posting_time\", \"set_posting_time\", \"due_date\", \"custom_is_expense\", \"custom_expense_against_purchase_order\", \"column_break1\", \"is_paid\", \"is_return\", \"return_against\", \"update_outstanding_for_self\", \"update_billed_amount_in_purchase_order\", \"update_billed_amount_in_purchase_receipt\", \"apply_tds\", \"is_reverse_charge\", \"tax_withholding_category\", \"amended_from\", \"supplier_invoice_details\", \"bill_no\", \"column_break_15\", \"bill_date\", \"accounting_dimensions_section\", \"cost_center\", \"dimension_col_break\", \"project\", \"currency_and_price_list\", \"currency\", \"conversion_rate\", \"use_transaction_date_exchange_rate\", \"column_break2\", \"buying_price_list\", \"price_list_currency\", \"plc_conversion_rate\", \"ignore_pricing_rule\", \"sec_warehouse\", \"scan_barcode\", \"col_break_warehouse\", \"update_stock\", \"set_warehouse\", \"set_from_warehouse\", \"is_subcontracted\", \"rejected_warehouse\", \"supplier_warehouse\", \"items_section\", \"items\", \"section_break_26\", \"total_qty\", \"total_net_weight\", \"column_break_50\", \"base_total\", \"base_net_total\", \"column_break_28\", \"total\", \"net_total\", \"tax_withholding_net_total\", \"base_tax_withholding_net_total\", \"taxes_section\", \"tax_category\", \"taxes_and_charges\", \"column_break_58\", \"shipping_rule\", \"column_break_49\", \"incoterm\", \"named_place\", \"section_break_51\", \"taxes\", \"totals\", \"base_taxes_and_charges_added\", \"base_taxes_and_charges_deducted\", \"base_total_taxes_and_charges\", \"column_break_40\", \"taxes_and_charges_added\", \"taxes_and_charges_deducted\", \"total_taxes_and_charges\", \"section_break_49\", \"base_grand_total\", \"base_rounding_adjustment\", \"base_rounded_total\", \"base_in_words\", \"column_break8\", \"grand_total\", \"rounding_adjustment\", \"use_company_roundoff_cost_center\", \"rounded_total\", \"in_words\", \"total_advance\", \"outstanding_amount\", \"disable_rounded_total\", \"section_break_44\", \"apply_discount_on\", \"base_discount_amount\", \"column_break_46\", \"additional_discount_percentage\", \"discount_amount\", \"tax_withheld_vouchers_section\", \"tax_withheld_vouchers\", \"sec_tax_breakup\", \"other_charges_calculation\", \"section_gst_breakup\", \"gst_breakup_table\", \"pricing_rule_details\", \"pricing_rules\", \"raw_materials_supplied\", \"supplied_items\", \"payments_tab\", \"payments_section\", \"mode_of_payment\", \"base_paid_amount\", \"clearance_date\", \"col_br_payments\", \"cash_bank_account\", \"paid_amount\", \"advances_section\", \"allocate_advances_automatically\", \"only_include_allocated_payments\", \"get_advances\", \"advances\", \"advance_tax\", \"write_off\", \"write_off_amount\", \"base_write_off_amount\", \"column_break_61\", \"write_off_account\", \"write_off_cost_center\", \"address_and_contact_tab\", \"section_addresses\", \"supplier_address\", \"address_display\", \"supplier_gstin\", \"gst_category\", \"col_break_address\", \"contact_person\", \"contact_display\", \"contact_mobile\", \"contact_email\", \"company_shipping_address_section\", \"shipping_address\", \"column_break_126\", \"shipping_address_display\", \"company_billing_address_section\", \"billing_address\", \"column_break_130\", \"billing_address_display\", \"company_gstin\", \"place_of_supply\", \"terms_tab\", \"payment_schedule_section\", \"payment_terms_template\", \"ignore_default_payment_terms_template\", \"payment_schedule\", \"terms_section_break\", \"tc_name\", \"terms\", \"more_info_tab\", \"status_section\", \"status\", \"column_break_177\", \"per_received\", \"accounting_details_section\", \"credit_to\", \"party_account_currency\", \"is_opening\", \"against_expense_account\", \"column_break_63\", \"unrealized_profit_loss_account\", \"repost_required\", \"subscription_section\", \"subscription\", \"auto_repeat\", \"update_auto_repeat_reference\", \"column_break_114\", \"from_date\", \"to_date\", \"printing_settings\", \"letter_head\", \"group_same_items\", \"column_break_112\", \"select_print_heading\", \"language\", \"transporter_info\", \"transporter\", \"gst_transporter_id\", \"driver\", \"lr_no\", \"vehicle_no\", \"distance\", \"transporter_col_break\", \"transporter_name\", \"mode_of_transport\", \"driver_name\", \"lr_date\", \"gst_vehicle_type\", \"gst_section\", \"itc_classification\", \"ineligibility_reason\", \"reconciliation_status\", \"gst_col_break\", \"itc_integrated_tax\", \"itc_central_tax\", \"itc_state_tax\", \"itc_cess_amount\", \"sb_14\", \"on_hold\", \"release_date\", \"cb_17\", \"hold_comment\", \"additional_info_section\", \"is_internal_supplier\", \"represents_company\", \"supplier_group\", \"column_break_147\", \"inter_company_invoice_reference\", \"is_old_subcontracting_flow\", \"remarks\", \"connections_tab\"]" + "value": "[\"custom_multi_po\", \"title\", \"naming_series\", \"supplier\", \"supplier_name\", \"ewaybill\", \"tax_id\", \"company\", \"custom_bill_of_lading_attachment\", \"custom_original_invoice_copy\", \"custom_packing_list_attachment\", \"column_break_6\", \"posting_date\", \"posting_time\", \"set_posting_time\", \"due_date\", \"custom_is_expense\", \"custom_expense_against_purchase_order\", \"custom_expense_against_multi_purchase_order\", \"custom_is_common\", \"custom_multi_purchase_order\", \"column_break1\", \"is_paid\", \"is_return\", \"return_against\", \"update_outstanding_for_self\", \"update_billed_amount_in_purchase_order\", \"update_billed_amount_in_purchase_receipt\", \"apply_tds\", \"is_reverse_charge\", \"tax_withholding_category\", \"amended_from\", \"supplier_invoice_details\", \"bill_no\", \"column_break_15\", \"bill_date\", \"accounting_dimensions_section\", \"cost_center\", \"dimension_col_break\", \"project\", \"currency_and_price_list\", \"currency\", \"conversion_rate\", \"use_transaction_date_exchange_rate\", \"column_break2\", \"buying_price_list\", \"price_list_currency\", \"plc_conversion_rate\", \"ignore_pricing_rule\", \"sec_warehouse\", \"scan_barcode\", \"col_break_warehouse\", \"update_stock\", \"set_warehouse\", \"set_from_warehouse\", \"is_subcontracted\", \"rejected_warehouse\", \"supplier_warehouse\", \"items_section\", \"items\", \"section_break_26\", \"total_qty\", \"total_net_weight\", \"column_break_50\", \"base_total\", \"base_net_total\", \"column_break_28\", \"total\", \"net_total\", \"tax_withholding_net_total\", \"base_tax_withholding_net_total\", \"taxes_section\", \"tax_category\", \"taxes_and_charges\", \"column_break_58\", \"shipping_rule\", \"column_break_49\", \"incoterm\", \"named_place\", \"section_break_51\", \"taxes\", \"totals\", \"base_taxes_and_charges_added\", \"base_taxes_and_charges_deducted\", \"base_total_taxes_and_charges\", \"column_break_40\", \"taxes_and_charges_added\", \"taxes_and_charges_deducted\", \"total_taxes_and_charges\", \"section_break_49\", \"base_grand_total\", \"base_rounding_adjustment\", \"base_rounded_total\", \"base_in_words\", \"column_break8\", \"grand_total\", \"rounding_adjustment\", \"use_company_roundoff_cost_center\", \"rounded_total\", \"in_words\", \"total_advance\", \"outstanding_amount\", \"disable_rounded_total\", \"section_break_44\", \"apply_discount_on\", \"base_discount_amount\", \"column_break_46\", \"additional_discount_percentage\", \"discount_amount\", \"tax_withheld_vouchers_section\", \"tax_withheld_vouchers\", \"sec_tax_breakup\", \"other_charges_calculation\", \"section_gst_breakup\", \"gst_breakup_table\", \"pricing_rule_details\", \"pricing_rules\", \"raw_materials_supplied\", \"supplied_items\", \"payments_tab\", \"payments_section\", \"mode_of_payment\", \"base_paid_amount\", \"clearance_date\", \"col_br_payments\", \"cash_bank_account\", \"paid_amount\", \"advances_section\", \"allocate_advances_automatically\", \"only_include_allocated_payments\", \"get_advances\", \"advances\", \"advance_tax\", \"write_off\", \"write_off_amount\", \"base_write_off_amount\", \"column_break_61\", \"write_off_account\", \"write_off_cost_center\", \"address_and_contact_tab\", \"section_addresses\", \"supplier_address\", \"address_display\", \"supplier_gstin\", \"gst_category\", \"col_break_address\", \"contact_person\", \"contact_display\", \"contact_mobile\", \"contact_email\", \"company_shipping_address_section\", \"shipping_address\", \"column_break_126\", \"shipping_address_display\", \"company_billing_address_section\", \"billing_address\", \"column_break_130\", \"billing_address_display\", \"company_gstin\", \"place_of_supply\", \"terms_tab\", \"payment_schedule_section\", \"payment_terms_template\", \"ignore_default_payment_terms_template\", \"payment_schedule\", \"terms_section_break\", \"tc_name\", \"terms\", \"more_info_tab\", \"status_section\", \"status\", \"column_break_177\", \"per_received\", \"accounting_details_section\", \"credit_to\", \"party_account_currency\", \"is_opening\", \"against_expense_account\", \"column_break_63\", \"unrealized_profit_loss_account\", \"subscription_section\", \"subscription\", \"auto_repeat\", \"update_auto_repeat_reference\", \"column_break_114\", \"from_date\", \"to_date\", \"printing_settings\", \"letter_head\", \"group_same_items\", \"column_break_112\", \"select_print_heading\", \"language\", \"transporter_info\", \"transporter\", \"gst_transporter_id\", \"driver\", \"lr_no\", \"vehicle_no\", \"distance\", \"transporter_col_break\", \"transporter_name\", \"mode_of_transport\", \"driver_name\", \"lr_date\", \"gst_vehicle_type\", \"gst_section\", \"itc_classification\", \"ineligibility_reason\", \"reconciliation_status\", \"gst_col_break\", \"itc_integrated_tax\", \"itc_central_tax\", \"itc_state_tax\", \"itc_cess_amount\", \"sb_14\", \"on_hold\", \"release_date\", \"cb_17\", \"hold_comment\", \"additional_info_section\", \"is_internal_supplier\", \"represents_company\", \"supplier_group\", \"sender\", \"column_break_147\", \"inter_company_invoice_reference\", \"is_old_subcontracting_flow\", \"remarks\", \"connections_tab\"]" }, { "_assign": null, @@ -2442,7 +2698,7 @@ "field_name": null, "idx": 0, "is_system_generated": 1, - "modified": "2024-04-27 17:26:59.208904", + "modified": "2024-12-04 17:23:12.684304", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-main-track_changes", @@ -2465,8 +2721,8 @@ "field_name": "naming_series", "idx": 0, "is_system_generated": 0, - "modified": "2024-09-14 12:57:31.207758", - "modified_by": "vivek@exacuer.com", + "modified": "2024-12-04 17:23:12.696832", + "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-naming_series-default", "owner": "vivek@exacuer.com", @@ -2480,7 +2736,7 @@ "_comments": null, "_liked_by": null, "_user_tags": null, - "creation": "2024-11-24 17:30:37.179724", + "creation": "2024-12-09 13:11:21.129820", "default_value": null, "doc_type": "Purchase Invoice", "docstatus": 0, @@ -2488,7 +2744,7 @@ "field_name": "naming_series", "idx": 0, "is_system_generated": 1, - "modified": "2024-11-24 17:30:37.179724", + "modified": "2024-12-09 13:11:21.129820", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-naming_series-options", @@ -2511,7 +2767,7 @@ "field_name": "payment_schedule", "idx": 0, "is_system_generated": 0, - "modified": "2024-04-17 19:11:51.569076", + "modified": "2024-12-04 17:23:12.722798", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-payment_schedule-print_hide", @@ -2534,7 +2790,7 @@ "field_name": "rounded_total", "idx": 0, "is_system_generated": 0, - "modified": "2024-04-18 17:39:16.275169", + "modified": "2024-12-04 17:23:12.735672", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-rounded_total-hidden", @@ -2557,7 +2813,7 @@ "field_name": "rounded_total", "idx": 0, "is_system_generated": 0, - "modified": "2024-04-18 17:39:16.285639", + "modified": "2024-12-04 17:23:12.748535", "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-rounded_total-print_hide", @@ -2572,7 +2828,7 @@ "_comments": null, "_liked_by": null, "_user_tags": null, - "creation": "2024-08-14 16:50:26.641487", + "creation": "2024-12-05 21:59:52.373989", "default_value": null, "doc_type": "Purchase Invoice", "docstatus": 0, @@ -2580,11 +2836,11 @@ "field_name": "scan_barcode", "idx": 0, "is_system_generated": 1, - "modified": "2024-08-14 16:50:26.641487", - "modified_by": "vivek@exacuer.com", + "modified": "2024-12-05 21:59:52.373989", + "modified_by": "Administrator", "module": null, "name": "Purchase Invoice-scan_barcode-hidden", - "owner": "vivek@exacuer.com", + "owner": "Administrator", "property": "hidden", "property_type": "Check", "row_name": null, diff --git a/nirjay_customization/nirjay_customization/doctype/__init__.py b/nirjay_customization/nirjay_customization/doctype/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/nirjay_customization/nirjay_customization/doctype/multi_purchase_order/__init__.py b/nirjay_customization/nirjay_customization/doctype/multi_purchase_order/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/nirjay_customization/nirjay_customization/doctype/multi_purchase_order/multi_purchase_order.js b/nirjay_customization/nirjay_customization/doctype/multi_purchase_order/multi_purchase_order.js new file mode 100644 index 0000000..0b0046b --- /dev/null +++ b/nirjay_customization/nirjay_customization/doctype/multi_purchase_order/multi_purchase_order.js @@ -0,0 +1,137 @@ +// Copyright (c) 2024, Hybrowlabs Technologies and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Multi Purchase Order', { + // Trigger when the form is loaded or refreshed + refresh: function (frm) { + // Recalculate grand total on refresh + calculate_grand_total(frm); + + + if (frm.doc.docstatus === 1) { + frm.add_custom_button(__('Purchase Invoice'), function () { + frappe.model.open_mapped_doc({ + method: "nirjay_customization.override.purchase_invoice.make_purchase_invoice", + frm: frm, + }); + }, __("Create")); + } + + }, + + // Custom function for adding purchase orders + add_po: function (frm) { + let selectedOrders = frm.doc.purchase_order + ? frm.doc.purchase_order.split(',').map(order => order.trim()).filter(Boolean) + : []; + + frappe.call({ + method: 'frappe.client.get_list', + args: { + doctype: 'Purchase Order', + fields: ['name', 'grand_total'], // Fetch name and grand total of Purchase Orders + filters: { + docstatus: ['!=', 2] // Exclude canceled Purchase Orders + }, + limit_page_length: 0, + }, + callback: function (response) { + if (response.message) { + let options = response.message + .filter(po => !selectedOrders.includes(po.name)) // Exclude selected orders + .map(po => ({ + value: po.name, + description: `Grand Total: ${po.grand_total}` + })); // Add grand total to description + + const dialog = new frappe.ui.Dialog({ + title: __('Select Purchase Order'), + fields: [ + { + label: __("Select Purchase Order"), + fieldtype: "MultiSelectList", + fieldname: "purchase_order", + placeholder: "Select Purchase Orders", + options: options, + reqd: 1, + get_data: function () { + return options; + } + } + ], + primary_action_label: __('Submit'), + primary_action: function (values) { + let newOrders = values['purchase_order'] || []; + let duplicates = newOrders.filter(order => selectedOrders.includes(order)); + + if (duplicates.length > 0) { + frappe.msgprint( + __("The following Purchase Orders are already selected: {0}.", [duplicates.join(', ')]) + ); + } else { + selectedOrders = [...new Set([...selectedOrders, ...newOrders])]; + frm.set_value("purchase_order", selectedOrders.join(', ')); + frm.refresh_field('purchase_order'); + + // Add selected Purchase Orders to the child table + response.message.forEach(po => { + if (newOrders.includes(po.name) && !frm.doc.items.some(row => row.purchase_order === po.name)) { + let newRow = frm.add_child('items'); + newRow.purchase_order = po.name; + newRow.purchase_order_grand_total = po.grand_total; // Set grand total + } + }); + + frm.refresh_field('items'); // Refresh the 'items' child table + calculate_grand_total(frm); // Update the parent grand total + } + + dialog.hide(); + $('body').removeClass('modal-open'); + } + }); + + dialog.show(); + $('body').addClass('modal-open'); + + let userCount = options.length; + let dynamicHeight = userCount * 100; + if (userCount > 10) { + dynamicHeight = 300; + } + + dialog.$wrapper.find('.modal-body').css({ + "overflow-y": "auto", + "height": dynamicHeight + "px", + "max-height": "90vh" + }); + } else { + frappe.msgprint(__('No Purchase Orders found.')); + } + } + }); + } +}); + +function calculate_grand_total(frm) { + let total = 0; + (frm.doc.items || []).forEach(row => { + total += row.total || 0; + }); + + frm.set_value('purchase_order_grand_total', total); + frm.refresh_field('purchase_order_grand_total'); + frm.save() +} + +frappe.ui.form.on('Multi Purchase Order Item', { + items_add: function (frm) { + calculate_grand_total(frm); + }, + items_remove: function (frm) { + calculate_grand_total(frm); + }, + purchase_order_grand_total: function (frm) { + calculate_grand_total(frm); + } +}); diff --git a/nirjay_customization/nirjay_customization/doctype/multi_purchase_order/multi_purchase_order.json b/nirjay_customization/nirjay_customization/doctype/multi_purchase_order/multi_purchase_order.json new file mode 100644 index 0000000..77865f2 --- /dev/null +++ b/nirjay_customization/nirjay_customization/doctype/multi_purchase_order/multi_purchase_order.json @@ -0,0 +1,117 @@ +{ + "actions": [], + "allow_rename": 1, + "autoname": "naming_series:", + "creation": "2024-12-23 10:23:40.429207", + "doctype": "DocType", + "engine": "InnoDB", + "field_order": [ + "section_break_c73f", + "amended_from", + "naming_series", + "purchase_order", + "add_po", + "items", + "purchase_order_grand_total", + "section_break_mhqj", + "currency", + "exchange_rate", + "price_list" + ], + "fields": [ + { + "fieldname": "section_break_c73f", + "fieldtype": "Section Break" + }, + { + "fieldname": "amended_from", + "fieldtype": "Link", + "label": "Amended From", + "no_copy": 1, + "options": "Multi Purchase Order", + "print_hide": 1, + "read_only": 1, + "search_index": 1 + }, + { + "fieldname": "purchase_order", + "fieldtype": "Small Text", + "label": "Purchase Order" + }, + { + "fieldname": "add_po", + "fieldtype": "Button", + "label": "Select Purchase Order" + }, + { + "fieldname": "items", + "fieldtype": "Table", + "label": "Purchase Order", + "options": "Purchase Order Item CT" + }, + { + "default": "PO.FY.-", + "fieldname": "naming_series", + "fieldtype": "Select", + "in_list_view": 1, + "label": "Series", + "no_copy": 1, + "options": "PO.FY.-", + "reqd": 1 + }, + { + "fieldname": "purchase_order_grand_total", + "fieldtype": "Float", + "label": "Purchase Order Grand Total" + }, + { + "fieldname": "section_break_mhqj", + "fieldtype": "Section Break", + "label": "Currency and Price List" + }, + { + "fieldname": "currency", + "fieldtype": "Link", + "label": "Currency", + "options": "Currency" + }, + { + "fieldname": "exchange_rate", + "fieldtype": "Float", + "label": "Exchange Rate" + }, + { + "fieldname": "price_list", + "fieldtype": "Link", + "label": "Price List", + "options": "Price List" + } + ], + "index_web_pages_for_search": 1, + "is_submittable": 1, + "links": [], + "modified": "2024-12-23 12:26:09.216182", + "modified_by": "Administrator", + "module": "Nirjay Customization", + "name": "Multi Purchase Order", + "naming_rule": "By \"Naming Series\" field", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "submit": 1, + "write": 1 + } + ], + "sort_field": "creation", + "sort_order": "DESC", + "states": [] +} \ No newline at end of file diff --git a/nirjay_customization/nirjay_customization/doctype/multi_purchase_order/multi_purchase_order.py b/nirjay_customization/nirjay_customization/doctype/multi_purchase_order/multi_purchase_order.py new file mode 100644 index 0000000..62f4425 --- /dev/null +++ b/nirjay_customization/nirjay_customization/doctype/multi_purchase_order/multi_purchase_order.py @@ -0,0 +1,9 @@ +# Copyright (c) 2024, Hybrowlabs Technologies and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + + +class MultiPurchaseOrder(Document): + pass diff --git a/nirjay_customization/nirjay_customization/doctype/multi_purchase_order/test_multi_purchase_order.py b/nirjay_customization/nirjay_customization/doctype/multi_purchase_order/test_multi_purchase_order.py new file mode 100644 index 0000000..30ed3a0 --- /dev/null +++ b/nirjay_customization/nirjay_customization/doctype/multi_purchase_order/test_multi_purchase_order.py @@ -0,0 +1,30 @@ +# Copyright (c) 2024, Hybrowlabs Technologies and Contributors +# See license.txt + +# import frappe +from frappe.tests import IntegrationTestCase, UnitTestCase + + +# On IntegrationTestCase, the doctype test records and all +# link-field test record depdendencies are recursively loaded +# Use these module variables to add/remove to/from that list +EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] +IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] + + +class UnitTestMultiPurchaseOrder(UnitTestCase): + """ + Unit tests for MultiPurchaseOrder. + Use this class for testing individual functions and methods. + """ + + pass + + +class IntegrationTestMultiPurchaseOrder(IntegrationTestCase): + """ + Integration tests for MultiPurchaseOrder. + Use this class for testing interactions between multiple components. + """ + + pass diff --git a/nirjay_customization/nirjay_customization/doctype/purchase_order_item_ct/__init__.py b/nirjay_customization/nirjay_customization/doctype/purchase_order_item_ct/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/nirjay_customization/nirjay_customization/doctype/purchase_order_item_ct/purchase_order_item_ct.json b/nirjay_customization/nirjay_customization/doctype/purchase_order_item_ct/purchase_order_item_ct.json new file mode 100644 index 0000000..303f010 --- /dev/null +++ b/nirjay_customization/nirjay_customization/doctype/purchase_order_item_ct/purchase_order_item_ct.json @@ -0,0 +1,60 @@ +{ + "actions": [], + "allow_rename": 1, + "creation": "2024-12-23 10:35:42.792925", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "purchase_order", + "total", + "taxable_amount", + "status" + ], + "fields": [ + { + "fieldname": "purchase_order", + "fieldtype": "Link", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Purchase Order", + "options": "Purchase Order" + }, + { + "fetch_from": "purchase_order.base_total", + "fieldname": "total", + "fieldtype": "Float", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Grand Total" + }, + { + "fieldname": "taxable_amount", + "fieldtype": "Float", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Taxable Amount\t" + }, + { + "fetch_from": "purchase_order.status", + "fieldname": "status", + "fieldtype": "Select", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Status", + "options": "\nDraft\nOn Hold\nTo Receive and Bill\nTo Bill\nTo Receive\nCompleted\nCancelled\nClosed\nDelivered" + } + ], + "index_web_pages_for_search": 1, + "istable": 1, + "links": [], + "modified": "2024-12-23 11:22:15.586721", + "modified_by": "Administrator", + "module": "Nirjay Customization", + "name": "Purchase Order Item CT", + "owner": "Administrator", + "permissions": [], + "sort_field": "creation", + "sort_order": "DESC", + "states": [] +} \ No newline at end of file diff --git a/nirjay_customization/nirjay_customization/doctype/purchase_order_item_ct/purchase_order_item_ct.py b/nirjay_customization/nirjay_customization/doctype/purchase_order_item_ct/purchase_order_item_ct.py new file mode 100644 index 0000000..22fdf73 --- /dev/null +++ b/nirjay_customization/nirjay_customization/doctype/purchase_order_item_ct/purchase_order_item_ct.py @@ -0,0 +1,9 @@ +# Copyright (c) 2024, Hybrowlabs Technologies and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + + +class PurchaseOrderItemCT(Document): + pass diff --git a/nirjay_customization/override/purchase_invoice.py b/nirjay_customization/override/purchase_invoice.py new file mode 100644 index 0000000..f522a08 --- /dev/null +++ b/nirjay_customization/override/purchase_invoice.py @@ -0,0 +1,32 @@ +import frappe +from frappe.model.mapper import get_mapped_doc + +@frappe.whitelist() +def make_purchase_invoice(source_name, target_doc=None): + def set_missing_values(source, target, source_parent=None): + target.custom_multi_po = 1 + target.custom_is_expense = 1 + target.custom_multi_purchase_order = source.name + + doc = get_mapped_doc( + "Multi Purchase Order", + source_name, + { + "Multi Purchase Order": { + "doctype": "Purchase Invoice", + "field_map": { + "amended_from": "amended_from", + "purchase_order": "purchase_order", + "items": "items", + "purchase_order_grand_total": "grand_total", + "currency": "currency", + "exchange_rate": "conversion_rate", + "price_list": "price_list", + }, + "postprocess": set_missing_values, + } + }, + target_doc + ) + + return doc