fix: multiple pos issues (#23725)

* fix: point of sale search

* fix: pos fetches expired serial nos

* fix: pos doesn't refresh on route change

* fix: opening balances not set in opening entry

* fix: remove debug statement

* fix: invalid query if no serial no is reserved by pos invoice

* chore: make new order btn primary

* chore: filter warehouse by company

* chore: add shortcuts for new order and email

* fix: cannot fetch serial no if no batch control

* chore: add shortcuts for menu items

* feat: standard keyboard shortcuts for pos page

* feat: display only items that are in stock

* fix: empty point of sale page if opening entry dialog is closed

* feat: conversion factor in pos item details

* fix: show all invalid mode of payments

* chore: show all items if allow negative stock is checked

* fix: -ve amount set when changing mode of payment

* fix: pos closing validations

* fix: test

* fix: non expired serial no fetching query

* fix: cannot dismiss pos opening creation dialog

* fix: transalation strings

* fix: msgprint to throw

* chore: use as_list in frappe.throw

* chore: clean up pos invoice.js & .py

* fix: codacy

* fix: transalation syntax

* fix: codacy

* fix: set_missing_values called twice from pos page

* fix: mode selector with double spaces

* fix: do not allow tables in pos additional fields

* fix: pos is not defined

* feat: set mode of payments for returns

* fix: remove naming series from pos profile

* fix: error message

* fix: minor bugs

* chore: re-arrange pos closing entry detail fields

* fix: sider & frappe linter

* fix: more translation strings

* fix: travis

* fix: more translation strings

* fix: sider

* fix: travis

* fix: unexpected end of string

* fix: travis
diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js
index be30086..99f3995 100644
--- a/erpnext/public/js/controllers/taxes_and_totals.js
+++ b/erpnext/public/js/controllers/taxes_and_totals.js
@@ -6,6 +6,7 @@
 
 	apply_pricing_rule_on_item: function(item){
 		let effective_item_rate = item.price_list_rate;
+		let item_rate = item.rate;
 		if (in_list(["Sales Order", "Quotation"], item.parenttype) && item.blanket_order_rate) {
 			effective_item_rate = item.blanket_order_rate;
 		}
@@ -17,15 +18,17 @@
 		}
 		item.base_rate_with_margin = flt(item.rate_with_margin) * flt(this.frm.doc.conversion_rate);
 
-		item.rate = flt(item.rate_with_margin , precision("rate", item));
+		item_rate = flt(item.rate_with_margin , precision("rate", item));
 
 		if(item.discount_percentage){
 			item.discount_amount = flt(item.rate_with_margin) * flt(item.discount_percentage) / 100;
 		}
 
 		if (item.discount_amount) {
-			item.rate = flt((item.rate_with_margin) - (item.discount_amount), precision('rate', item));
+			item_rate = flt((item.rate_with_margin) - (item.discount_amount), precision('rate', item));
 		}
+
+		frappe.model.set_value(item.doctype, item.name, "rate", item_rate);
 	},
 
 	calculate_taxes_and_totals: function(update_paid_amount) {
@@ -88,11 +91,8 @@
 			if(this.frm.doc.currency == company_currency) {
 				this.frm.set_value("conversion_rate", 1);
 			} else {
-				const err_message = __('{0} is mandatory. Maybe Currency Exchange record is not created for {1} to {2}', [
-					conversion_rate_label,
-					this.frm.doc.currency,
-					company_currency
-				]);
+				const subs =  [conversion_rate_label, this.frm.doc.currency, company_currency];
+				const err_message = __('{0} is mandatory. Maybe Currency Exchange record is not created for {1} to {2}', subs);
 				frappe.throw(err_message);
 			}
 		}
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index 3391179..23705a8 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -1049,14 +1049,13 @@
 		if(item.item_code && item.uom) {
 			return this.frm.call({
 				method: "erpnext.stock.get_item_details.get_conversion_factor",
-				child: item,
 				args: {
 					item_code: item.item_code,
 					uom: item.uom
 				},
 				callback: function(r) {
 					if(!r.exc) {
-						me.conversion_factor(me.frm.doc, cdt, cdn);
+						frappe.model.set_value(cdt, cdn, 'conversion_factor', r.message.conversion_factor);
 					}
 				}
 			});