diff --git a/invoice_az/client/sales_invoice.js b/invoice_az/client/sales_invoice.js index 8137b05..7e7b2f0 100644 --- a/invoice_az/client/sales_invoice.js +++ b/invoice_az/client/sales_invoice.js @@ -1715,6 +1715,14 @@ function show_object_picker_dialog(frm, objects, customerName, taxId) { objectsHtml += '' + __('Address') + ''; objectsHtml += ''; + // Empty object option + objectsHtml += ''; + objectsHtml += ''; + objectsHtml += '—'; + objectsHtml += '—'; + objectsHtml += '' + __('Without object') + ''; + objectsHtml += ''; + objects.forEach(function(obj, index) { const objectName = obj.name || '-'; const objectCode = obj.code || '-'; @@ -1767,7 +1775,7 @@ function show_object_picker_dialog(frm, objects, customerName, taxId) { return; } - const selectedObject = objects[parseInt(selectedIndex)]; + const objectCode = selectedIndex === 'empty' ? '' : objects[parseInt(selectedIndex)].code; // Hide dialog d.hide(); @@ -1780,7 +1788,7 @@ function show_object_picker_dialog(frm, objects, customerName, taxId) { doctype: 'Sales Invoice', name: frm.doc.name, fieldname: 'customer_object_name', - value: selectedObject.code + value: objectCode }, callback: function(r) { if (r.message) {