42 lines
940 B
JavaScript
42 lines
940 B
JavaScript
/**
|
||
* Интеграция формы подбора с Quotation
|
||
*/
|
||
|
||
frappe.ui.form.on('Quotation', {
|
||
refresh: function(frm) {
|
||
if (frm.doc.docstatus === 0) {
|
||
setup_selection_button(frm);
|
||
}
|
||
}
|
||
});
|
||
|
||
function setup_selection_button(frm) {
|
||
const grid = frm.fields_dict.items.grid;
|
||
|
||
grid.wrapper.find('.grid-add-multiple-rows').remove();
|
||
|
||
$('<button type="button" class="grid-add-multiple-rows btn btn-xs btn-secondary">')
|
||
.html(__('Add Multiple'))
|
||
.insertAfter(grid.wrapper.find('.grid-add-row'))
|
||
.on('click', function(e) {
|
||
e.stopImmediatePropagation();
|
||
|
||
if (!frm.doc.party_name) {
|
||
frappe.msgprint({
|
||
title: __('Warning'),
|
||
message: __('Please select Party first'),
|
||
indicator: 'orange'
|
||
});
|
||
return;
|
||
}
|
||
|
||
const selection_dialog = new SelectionDialog({
|
||
frm: frm,
|
||
doctype: 'Quotation',
|
||
child_doctype: 'Quotation Item',
|
||
has_rate: true
|
||
});
|
||
selection_dialog.show();
|
||
});
|
||
}
|