fix: payment schedule table is empty while duplicating record

This commit is contained in:
Ejaaz Khan
2025-02-05 00:06:48 +05:30
parent 18127603fe
commit fb3f08a441
2 changed files with 11 additions and 3 deletions

View File

@@ -336,6 +336,8 @@ erpnext.accounts.PurchaseInvoice = class PurchaseInvoice extends erpnext.buying.
if (this.frm.doc.__onload && this.frm.doc.__onload.load_after_mapping) return;
let payment_terms_template = this.frm.doc.payment_terms_template;
erpnext.utils.get_party_details(
this.frm,
"erpnext.accounts.party.get_party_details",
@@ -347,9 +349,7 @@ erpnext.accounts.PurchaseInvoice = class PurchaseInvoice extends erpnext.buying.
account: this.frm.doc.credit_to,
price_list: this.frm.doc.buying_price_list,
fetch_payment_terms_template: cint(
(this.frm.doc.is_return == 0) &
!this.frm.doc.ignore_default_payment_terms_template &
(this.frm.doc.__run_link_triggers !== false)
(this.frm.doc.is_return == 0) & !this.frm.doc.ignore_default_payment_terms_template
),
},
function () {
@@ -358,6 +358,12 @@ erpnext.accounts.PurchaseInvoice = class PurchaseInvoice extends erpnext.buying.
me.frm.doc.tax_withholding_category = me.frm.supplier_tds;
me.frm.set_df_property("apply_tds", "read_only", me.frm.supplier_tds ? 0 : 1);
me.frm.set_df_property("tax_withholding_category", "hidden", me.frm.supplier_tds ? 0 : 1);
// while duplicating, don't change payment terms
if (me.frm.doc.__run_link_triggers === false) {
me.frm.set_value("payment_terms_template", payment_terms_template);
me.frm.refresh_field("payment_terms_template");
}
}
);
}

View File

@@ -2518,6 +2518,8 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
}
payment_terms_template() {
console.log("payment_terms_template outside");
var me = this;
const doc = this.frm.doc;
if(doc.payment_terms_template && doc.doctype !== 'Delivery Note' && !doc.is_return) {