From 6087d5a6038d6e636ce1ba006ebd59e820b3cd8e Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Mon, 20 Dec 2021 12:16:14 +0530 Subject: [PATCH 1/5] fix(UX): Optimize rate updation of changing price list --- erpnext/public/js/controllers/transaction.js | 7 +++++-- erpnext/stock/get_item_details.py | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 42e7ed68e30..e9490009a8f 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -1566,17 +1566,19 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ var items_rule_dict = {}; for(var i=0, l=children.length; i Date: Mon, 20 Dec 2021 13:26:16 +0530 Subject: [PATCH 2/5] fix: Linting issues --- erpnext/public/js/controllers/transaction.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index e9490009a8f..5146776e2d1 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -1567,7 +1567,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ for(var i=0, l=children.length; i Date: Wed, 22 Dec 2021 11:26:19 +0530 Subject: [PATCH 3/5] fix: Recalculate taxes irrespective of price list rate changed or not --- erpnext/public/js/controllers/transaction.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 5146776e2d1..5b1630a2677 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -1562,7 +1562,6 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ _set_values_for_item_list: function(children) { var me = this; - var price_list_rate_changed = false; var items_rule_dict = {}; for(var i=0, l=children.length; i Date: Wed, 22 Dec 2021 12:01:39 +0530 Subject: [PATCH 4/5] fix: Add round floats for price list rate --- erpnext/public/js/controllers/transaction.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 5b1630a2677..47454b9a789 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -680,7 +680,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ var item = frappe.get_doc(cdt, cdn); frappe.model.round_floats_in(item, ["price_list_rate", "discount_percentage"]); - // check if child doctype is Sales Order Item/Qutation Item and calculate the rate + // check if child doctype is Sales Order Item/Quotation Item and calculate the rate if (in_list(["Quotation Item", "Sales Order Item", "Delivery Note Item", "Sales Invoice Item", "POS Invoice Item", "Purchase Invoice Item", "Purchase Order Item", "Purchase Receipt Item"]), cdt) this.apply_pricing_rule_on_item(item); else @@ -1581,6 +1581,8 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ } } + frappe.model.round_floats_in(item_row, ["price_list_rate", "discount_percentage"]); + // if pricing rule set as blank from an existing value, apply price_list if(!me.frm.doc.ignore_pricing_rule && existing_pricing_rule && !d.pricing_rules) { me.apply_price_list(frappe.get_doc(d.doctype, d.name)); From b2e42aa16c325b196ff2c80a46ccde1d2e67e147 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 23 Dec 2021 21:17:42 +0530 Subject: [PATCH 5/5] chore: add running stock value difference in invariant report (#29012) (#29013) [skip ci] (cherry picked from commit 7987a4650947a2ac551b9b76fdca6bb5b4836295) Co-authored-by: Ankush Menat --- .../stock_ledger_invariant_check.js | 3 ++- .../stock_ledger_invariant_check.py | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/report/stock_ledger_invariant_check/stock_ledger_invariant_check.js b/erpnext/stock/report/stock_ledger_invariant_check/stock_ledger_invariant_check.js index c484516a163..31f389f236e 100644 --- a/erpnext/stock/report/stock_ledger_invariant_check/stock_ledger_invariant_check.js +++ b/erpnext/stock/report/stock_ledger_invariant_check/stock_ledger_invariant_check.js @@ -8,7 +8,8 @@ const DIFFERNCE_FIELD_NAMES = [ "fifo_value_diff", "fifo_valuation_diff", "valuation_diff", - "fifo_difference_diff" + "fifo_difference_diff", + "diff_value_diff" ]; frappe.query_reports["Stock Ledger Invariant Check"] = { diff --git a/erpnext/stock/report/stock_ledger_invariant_check/stock_ledger_invariant_check.py b/erpnext/stock/report/stock_ledger_invariant_check/stock_ledger_invariant_check.py index ca47a1ec5b8..48753b0edd4 100644 --- a/erpnext/stock/report/stock_ledger_invariant_check/stock_ledger_invariant_check.py +++ b/erpnext/stock/report/stock_ledger_invariant_check/stock_ledger_invariant_check.py @@ -50,6 +50,7 @@ def get_stock_ledger_entries(filters): def add_invariant_check_fields(sles): balance_qty = 0.0 + balance_stock_value = 0.0 for idx, sle in enumerate(sles): queue = json.loads(sle.stock_queue) @@ -60,6 +61,7 @@ def add_invariant_check_fields(sles): fifo_value += qty * rate balance_qty += sle.actual_qty + balance_stock_value += sle.stock_value_difference if sle.voucher_type == "Stock Reconciliation" and not sle.batch_no: balance_qty = sle.qty_after_transaction @@ -70,6 +72,7 @@ def add_invariant_check_fields(sles): sle.stock_value / sle.qty_after_transaction if sle.qty_after_transaction else None ) sle.expected_qty_after_transaction = balance_qty + sle.stock_value_from_diff = balance_stock_value # set difference fields sle.difference_in_qty = sle.qty_after_transaction - sle.expected_qty_after_transaction @@ -81,6 +84,7 @@ def add_invariant_check_fields(sles): sle.valuation_diff = ( sle.valuation_rate - sle.balance_value_by_qty if sle.balance_value_by_qty else None ) + sle.diff_value_diff = sle.stock_value_from_diff - sle.stock_value if idx > 0: sle.fifo_stock_diff = sle.fifo_stock_value - sles[idx - 1].fifo_stock_value @@ -191,12 +195,21 @@ def get_columns(): "fieldtype": "Float", "label": "D - E", }, - { "fieldname": "stock_value_difference", "fieldtype": "Float", "label": "(F) Stock Value Difference", }, + { + "fieldname": "stock_value_from_diff", + "fieldtype": "Float", + "label": "Balance Stock Value using (F)", + }, + { + "fieldname": "diff_value_diff", + "fieldtype": "Float", + "label": "K - D", + }, { "fieldname": "fifo_stock_diff", "fieldtype": "Float",