Skip to content

Commit

Permalink
fix: Reset advance paid amount on Oreder cancel and amend
Browse files Browse the repository at this point in the history
(cherry picked from commit 92f37ca)

# Conflicts:
#	erpnext/buying/doctype/purchase_order/purchase_order.js
  • Loading branch information
deepeshgarg007 authored and mergify[bot] committed Oct 31, 2022
1 parent 0c24ba0 commit e32e0bc
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
28 changes: 28 additions & 0 deletions erpnext/buying/doctype/purchase_order/purchase_order.js
Expand Up @@ -84,7 +84,35 @@ frappe.ui.form.on("Purchase Order", {
});
}, __('Create'));
}
<<<<<<< HEAD
}
=======
},

onload: function(frm) {
set_schedule_date(frm);
if (!frm.doc.transaction_date){
frm.set_value('transaction_date', frappe.datetime.get_today())
}

erpnext.queries.setup_queries(frm, "Warehouse", function() {
return erpnext.queries.warehouse(frm.doc);
});

// On cancel and amending a purchase order with advance payment, reset advance paid amount
if (frm.is_new()) {
frm.set_value("advance_paid", 0)
}
},

apply_tds: function(frm) {
if (!frm.doc.apply_tds) {
frm.set_value("tax_withholding_category", '');
} else {
frm.set_value("tax_withholding_category", frm.supplier_tds);
}
},
>>>>>>> 92f37ca111 (fix: Reset advance paid amount on Oreder cancel and amend)
});

frappe.ui.form.on("Purchase Order Item", {
Expand Down
5 changes: 5 additions & 0 deletions erpnext/selling/doctype/sales_order/sales_order.js
Expand Up @@ -95,6 +95,11 @@ frappe.ui.form.on("Sales Order", {
return query;
});

// On cancel and amending a sales order with advance payment, reset advance paid amount
if (frm.is_new()) {
frm.set_value("advance_paid", 0)
}

frm.ignore_doctypes_on_cancel_all = ['Purchase Order'];
},

Expand Down

0 comments on commit e32e0bc

Please sign in to comment.