selections/selections/public/js/quotation.js

42 lines
940 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* Интеграция формы подбора с 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();
});
}