fix: allow sending invoice without customer object selection
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
10be61958c
commit
c561371a16
|
|
@ -1715,6 +1715,14 @@ function show_object_picker_dialog(frm, objects, customerName, taxId) {
|
|||
objectsHtml += '<th style="width: 40%;">' + __('Address') + '</th>';
|
||||
objectsHtml += '</tr></thead><tbody>';
|
||||
|
||||
// Empty object option
|
||||
objectsHtml += '<tr class="object-row" data-index="empty" style="cursor: pointer;">';
|
||||
objectsHtml += '<td><input type="radio" name="object_selection" value="empty" class="object-radio"></td>';
|
||||
objectsHtml += '<td>—</td>';
|
||||
objectsHtml += '<td>—</td>';
|
||||
objectsHtml += '<td style="color: var(--text-muted);">' + __('Without object') + '</td>';
|
||||
objectsHtml += '</tr>';
|
||||
|
||||
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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue