Fixes to handle async events (#11018)
* Fixes to handle async events * transaction.js code cleanup * Don't map taxes and charges while making PO from SO for drop-ship * Removed print
This commit is contained in:
parent
7eba1a35d3
commit
7b6eaee05b
@ -101,27 +101,6 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
|||||||
return me.set_query_for_batch(doc, cdt, cdn)
|
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"]) {
|
if(this.frm.fields_dict["taxes"]) {
|
||||||
this["taxes_remove"] = this.calculate_taxes_and_totals;
|
this["taxes_remove"] = this.calculate_taxes_and_totals;
|
||||||
@ -153,11 +132,36 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
filters: filters
|
filters: filters
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
onload: function() {
|
||||||
|
var me = this;
|
||||||
|
|
||||||
this.setup_quality_inspection();
|
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() {
|
setup_quality_inspection: function() {
|
||||||
@ -195,13 +199,12 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
onload_post_render: function() {
|
onload_post_render: function() {
|
||||||
var me = this;
|
|
||||||
if(this.frm.doc.__islocal && !(this.frm.doc.taxes || []).length
|
if(this.frm.doc.__islocal && !(this.frm.doc.taxes || []).length
|
||||||
&& !(this.frm.doc.__onload ? this.frm.doc.__onload.load_after_mapping : false)) {
|
&& !(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"]
|
} else if(this.frm.doc.__islocal && this.frm.doc.company && this.frm.doc["items"]
|
||||||
&& !this.frm.doc.is_pos) {
|
&& !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")) {
|
if(frappe.meta.get_docfield(this.frm.doc.doctype + " Item", "item_code")) {
|
||||||
this.setup_item_selector();
|
this.setup_item_selector();
|
||||||
|
@ -13,7 +13,6 @@ class StudentApplicant(Document):
|
|||||||
if self.student_admission:
|
if self.student_admission:
|
||||||
naming_series = frappe.db.get_value('Student Admission', self.student_admission,
|
naming_series = frappe.db.get_value('Student Admission', self.student_admission,
|
||||||
'naming_series_for_student_applicant')
|
'naming_series_for_student_applicant')
|
||||||
print(naming_series)
|
|
||||||
|
|
||||||
if naming_series:
|
if naming_series:
|
||||||
self.naming_series = naming_series
|
self.naming_series = naming_series
|
||||||
|
@ -696,7 +696,8 @@ def make_purchase_order_for_drop_shipment(source_name, for_supplier, target_doc=
|
|||||||
"contact_display",
|
"contact_display",
|
||||||
"contact_mobile",
|
"contact_mobile",
|
||||||
"contact_email",
|
"contact_email",
|
||||||
"contact_person"
|
"contact_person",
|
||||||
|
"taxes_and_charges"
|
||||||
],
|
],
|
||||||
"validation": {
|
"validation": {
|
||||||
"docstatus": ["=", 1]
|
"docstatus": ["=", 1]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user