“Is there another place I should be looking?”
imo no you are on target taxes_and_totals.py - and also too transaction.js that extends it - together implement multi-currency
'warehouse': in_list('Purchase Receipt', 'Purchase Invoice') ? item.from_warehouse : item.warehouse,
'posting_date': posting_date,
'posting_time': posting_time,
'qty': item.qty * item.conversion_factor,
'serial_no': item.serial_no,
'batch_no': item.batch_no,
'voucher_type': voucher_type,
'company': company,
'allow_zero_valuation_rate': item.allow_zero_valuation_rate
}
frappe.call({
method: 'erpnext.stock.utils.get_incoming_rate',
args: {
args: item_args
},
callback: function(r) {
frappe.model.set_value(item.doctype, item.name, 'rate', r.message * item.conversion_factor);
}
});
}
serial_no(doc, cdt, cdn) {
var me = this;
var item = frappe.get_doc(cdt, cdn);
if (item && item.doctype === 'Purchase Receipt Item Supplied') {
return;
}
if (item && item.serial_no) {
if (!item.item_code) {
this.frm.trigger("item_code", cdt, cdn);
}
else {
// Replace all occurences of comma with line feed
item.serial_no = item.serial_no.replace(/,/g, '\n');
item.conversion_factor = item.conversion_factor || 1;
refresh_field("serial_no", item.name, item.parentfield);
if (!doc.is_return && cint(frappe.user_defaults.set_qty_in_transactions_based_on_serial_no_input)) {
setTimeout(() => {
me.update_qty(cdt, cdn);
if (!item.item_code) {
this.frm.trigger("item_code", cdt, cdn);
}
else {
// Replace all occurences of comma with line feed
item.serial_no = item.serial_no.replace(/,/g, '\n');
item.conversion_factor = item.conversion_factor || 1;
refresh_field("serial_no", item.name, item.parentfield);
if (!doc.is_return && cint(frappe.user_defaults.set_qty_in_transactions_based_on_serial_no_input)) {
setTimeout(() => {
me.update_qty(cdt, cdn);
}, 10000);
}
}
}
}
update_qty(cdt, cdn) {
var valid_serial_nos = [];
var serialnos = [];
var item = frappe.get_doc(cdt, cdn);
Many thanks for shilgod’s insight Quotation Item triggers - #6 by schilgod
That ahha moment how jQuery.extend() | jQuery API Documentation aparently interfaces and extends a python object with a js object with this statement really escapes me:
erpnext.TransactionController = erpnext.taxes_and_totals.extend({
jquery.extend - An object that will receive the new properties if additional objects are passed in or that will extend the jQuery namespace if it is the sole argument.
1 Like