Skip to content

Commit

Permalink
fix: reset voucher_type and voucher_no if based_on is set to `I…
Browse files Browse the repository at this point in the history
…tem and Warehouse`

(cherry picked from commit eeec008)
  • Loading branch information
s-aga-r authored and mergify[bot] committed Nov 29, 2022
1 parent b08d36c commit ff59483
Showing 1 changed file with 16 additions and 0 deletions.
Expand Up @@ -34,6 +34,22 @@ frappe.ui.form.on('Repost Item Valuation', {
frm.trigger('setup_realtime_progress');
},

based_on: function(frm) {
var fields_to_reset = [];

if (frm.doc.based_on == 'Transaction') {
fields_to_reset = ['item_code', 'warehouse'];
} else if (frm.doc.based_on == 'Item and Warehouse') {
fields_to_reset = ['voucher_type', 'voucher_no'];
}

if (fields_to_reset) {
fields_to_reset.forEach(field => {
frm.set_value(field, undefined);
});
}
},

setup_realtime_progress: function(frm) {
frappe.realtime.on('item_reposting_progress', data => {
if (frm.doc.name !== data.name) {
Expand Down

0 comments on commit ff59483

Please sign in to comment.