diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index c83e6df92c..5b647f80d2 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -101,27 +101,6 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ return me.set_query_for_batch(doc, cdt, cdn) }); } - }, - onload: function() { - var me = this; - if(this.frm.doc.__islocal) { - var today = frappe.datetime.get_today(), - currency = frappe.defaults.get_user_default("currency"); - - $.each({ - currency: currency, - price_list_currency: currency, - status: "Draft", - is_subcontracted: "No", - }, function(fieldname, value) { - if(me.frm.fields_dict[fieldname] && !me.frm.doc[fieldname]) - me.frm.set_value(fieldname, value); - }); - - if(this.frm.doc.company && !this.frm.doc.amended_from) { - this.frm.trigger("company"); - } - } if(this.frm.fields_dict["taxes"]) { this["taxes_remove"] = this.calculate_taxes_and_totals; @@ -153,11 +132,36 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ return { filters: filters - } + }; }); } + }, + onload: function() { + var me = this; this.setup_quality_inspection(); + + if(this.frm.doc.__islocal) { + var currency = frappe.defaults.get_user_default("currency"); + + let set_value = (fieldname, value) => { + if(me.frm.fields_dict[fieldname] && !me.frm.doc[fieldname]) { + return me.frm.set_value(fieldname, value); + } + }; + + return frappe.run_serially([ + () => set_value('currency', currency), + () => set_value('price_list_currency', currency), + () => set_value('status', 'Draft'), + () => set_value('is_subcontracted', 'No'), + () => { + if(this.frm.doc.company && !this.frm.doc.amended_from) { + this.frm.trigger("company"); + } + } + ]); + } }, setup_quality_inspection: function() { @@ -195,13 +199,12 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ }, onload_post_render: function() { - var me = this; if(this.frm.doc.__islocal && !(this.frm.doc.taxes || []).length && !(this.frm.doc.__onload ? this.frm.doc.__onload.load_after_mapping : false)) { - this.apply_default_taxes(); + frappe.after_ajax(() => this.apply_default_taxes()); } else if(this.frm.doc.__islocal && this.frm.doc.company && this.frm.doc["items"] && !this.frm.doc.is_pos) { - me.calculate_taxes_and_totals(); + frappe.after_ajax(() => this.calculate_taxes_and_totals()); } if(frappe.meta.get_docfield(this.frm.doc.doctype + " Item", "item_code")) { this.setup_item_selector(); diff --git a/erpnext/schools/doctype/student_applicant/student_applicant.py b/erpnext/schools/doctype/student_applicant/student_applicant.py index 081fa065db..aeeffcedac 100644 --- a/erpnext/schools/doctype/student_applicant/student_applicant.py +++ b/erpnext/schools/doctype/student_applicant/student_applicant.py @@ -13,7 +13,6 @@ class StudentApplicant(Document): if self.student_admission: naming_series = frappe.db.get_value('Student Admission', self.student_admission, 'naming_series_for_student_applicant') - print(naming_series) if naming_series: self.naming_series = naming_series diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index 613b0bb31f..98333c495e 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -696,7 +696,8 @@ def make_purchase_order_for_drop_shipment(source_name, for_supplier, target_doc= "contact_display", "contact_mobile", "contact_email", - "contact_person" + "contact_person", + "taxes_and_charges" ], "validation": { "docstatus": ["=", 1]