diff --git a/.github/workflows/server-tests-mariadb.yml b/.github/workflows/server-tests-mariadb.yml index 036f587dbf9..2bfe5e7065d 100644 --- a/.github/workflows/server-tests-mariadb.yml +++ b/.github/workflows/server-tests-mariadb.yml @@ -7,6 +7,7 @@ on: paths-ignore: - '**.js' - '**.css' + - '**.svg' - '**.md' - '**.html' - 'crowdin.yml' diff --git a/erpnext/assets/doctype/asset/asset.js b/erpnext/assets/doctype/asset/asset.js index b8a8dd6db10..dc65883eb15 100644 --- a/erpnext/assets/doctype/asset/asset.js +++ b/erpnext/assets/doctype/asset/asset.js @@ -231,28 +231,64 @@ frappe.ui.form.on("Asset", { }, toggle_reference_doc: function (frm) { - if (frm.doc.purchase_receipt && frm.doc.purchase_invoice && frm.doc.docstatus === 1) { - frm.set_df_property("purchase_invoice", "read_only", 1); - frm.set_df_property("purchase_receipt", "read_only", 1); - } else if (frm.doc.is_existing_asset || frm.doc.is_composite_asset) { - frm.toggle_reqd("purchase_receipt", 0); - frm.toggle_reqd("purchase_invoice", 0); - frm.set_value("purchase_receipt", ""); - frm.set_value("purchase_invoice", ""); - } else if (frm.doc.purchase_receipt) { - // if purchase receipt link is set then set PI disabled - frm.toggle_reqd("purchase_invoice", 0); - frm.set_df_property("purchase_invoice", "read_only", 1); - } else if (frm.doc.purchase_invoice) { - // if purchase invoice link is set then set PR disabled - frm.toggle_reqd("purchase_receipt", 0); - frm.set_df_property("purchase_receipt", "read_only", 1); - } else { - frm.toggle_reqd("purchase_receipt", 1); - frm.set_df_property("purchase_receipt", "read_only", 0); - frm.toggle_reqd("purchase_invoice", 1); - frm.set_df_property("purchase_invoice", "read_only", 0); + const is_submitted = frm.doc.docstatus === 1; + const is_special_asset = frm.doc.is_existing_asset || frm.doc.is_composite_asset; + + const clear_field = (field) => { + if (frm.doc[field]) { + frm.set_value(field, ""); + } + }; + + ["purchase_receipt", "purchase_receipt_item", "purchase_invoice", "purchase_invoice_item"].forEach( + (field) => { + frm.toggle_reqd(field, 0); + frm.set_df_property(field, "read_only", 0); + } + ); + + if (is_submitted) { + [ + "purchase_receipt", + "purchase_receipt_item", + "purchase_invoice", + "purchase_invoice_item", + ].forEach((field) => { + frm.set_df_property(field, "read_only", 1); + }); + return; } + + if (is_special_asset) { + clear_field("purchase_receipt"); + clear_field("purchase_receipt_item"); + clear_field("purchase_invoice"); + clear_field("purchase_invoice_item"); + return; + } + + if (frm.doc.purchase_receipt) { + frm.toggle_reqd("purchase_receipt_item", 1); + + ["purchase_invoice", "purchase_invoice_item"].forEach((field) => { + clear_field(field); + frm.set_df_property(field, "read_only", 1); + }); + return; + } + + if (frm.doc.purchase_invoice) { + frm.toggle_reqd("purchase_invoice_item", 1); + + ["purchase_receipt", "purchase_receipt_item"].forEach((field) => { + clear_field(field); + frm.set_df_property(field, "read_only", 1); + }); + return; + } + + frm.toggle_reqd("purchase_receipt", 1); + frm.toggle_reqd("purchase_invoice", 1); }, make_journal_entry: function (frm) { diff --git a/erpnext/patches.txt b/erpnext/patches.txt index dab56f9f552..c82e257dc6c 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -456,4 +456,5 @@ erpnext.patches.v16_0.update_tax_withholding_field_in_payment_entry erpnext.patches.v16_0.migrate_tax_withholding_data erpnext.patches.v16_0.update_corrected_cancelled_status erpnext.patches.v16_0.fix_barcode_typo -erpnext.patches.v16_0.set_post_change_gl_entries_on_pos_settings \ No newline at end of file +erpnext.patches.v16_0.set_post_change_gl_entries_on_pos_settings +execute:frappe.delete_doc_if_exists("Workspace Sidebar", "Opening & Closing") diff --git a/erpnext/public/icons/desktop_icons/solid/share_management.svg b/erpnext/public/icons/desktop_icons/solid/share_management.svg new file mode 100644 index 00000000000..bea49a5c5f0 --- /dev/null +++ b/erpnext/public/icons/desktop_icons/solid/share_management.svg @@ -0,0 +1,4 @@ + + + + diff --git a/erpnext/public/icons/desktop_icons/subtle/share_management.svg b/erpnext/public/icons/desktop_icons/subtle/share_management.svg new file mode 100644 index 00000000000..c9bf99f0821 --- /dev/null +++ b/erpnext/public/icons/desktop_icons/subtle/share_management.svg @@ -0,0 +1,4 @@ + + + +