fix: only show "Unreconcile" if reconciled

This commit is contained in:
barredterra 2023-06-15 18:09:56 +02:00
parent 0e517227ee
commit 91e574609f

View File

@ -13,10 +13,11 @@ frappe.ui.form.on("Bank Transaction", {
}); });
}, },
refresh(frm) { refresh(frm) {
frm.add_custom_button(__('Unreconcile Transaction'), () => { if (!frm.is_dirty() && frm.doc.payment_entries.length > 0) {
frm.call('remove_payment_entries') frm.add_custom_button(__("Unreconcile Transaction"), () => {
.then( () => frm.refresh() ); frm.call("remove_payment_entries").then(() => frm.refresh());
}); });
}
}, },
bank_account: function (frm) { bank_account: function (frm) {
set_bank_statement_filter(frm); set_bank_statement_filter(frm);