From 60aad31162aedb7be484cde53d7ca069065b2002 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Mon, 4 Jul 2022 18:38:26 +0530 Subject: [PATCH 1/3] fix: Incorrect provisional expense booking while reposting --- erpnext/stock/doctype/purchase_receipt/purchase_receipt.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index fcf0cd182d..704e1fc2f9 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -511,6 +511,7 @@ class PurchaseReceipt(BuyingController): and not d.is_fixed_asset and flt(d.qty) and provisional_accounting_for_non_stock_items + and d.get("provisional_expense_account") ): self.add_provisional_gl_entry( d, gl_entries, self.posting_date, d.get("provisional_expense_account") From 90942d2ba542d0e1cfbdc03c1ca65960022940ad Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Tue, 5 Jul 2022 11:22:32 +0530 Subject: [PATCH 2/3] chore: remove currency info from boot (#31520) refactor: remove currency info from boot Framework loads this info by default now, so no need to add it here. --- erpnext/startup/boot.py | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/erpnext/startup/boot.py b/erpnext/startup/boot.py index c3445ab644..bb120eaa6b 100644 --- a/erpnext/startup/boot.py +++ b/erpnext/startup/boot.py @@ -14,7 +14,6 @@ def boot_session(bootinfo): if frappe.session["user"] != "Guest": update_page_info(bootinfo) - load_country_and_currency(bootinfo) bootinfo.sysdefaults.territory = frappe.db.get_single_value("Selling Settings", "territory") bootinfo.sysdefaults.customer_group = frappe.db.get_single_value( "Selling Settings", "customer_group" @@ -53,20 +52,6 @@ def boot_session(bootinfo): bootinfo.party_account_types = frappe._dict(party_account_types) -def load_country_and_currency(bootinfo): - country = frappe.db.get_default("country") - if country and frappe.db.exists("Country", country): - bootinfo.docs += [frappe.get_doc("Country", country)] - - bootinfo.docs += frappe.db.sql( - """select name, fraction, fraction_units, - number_format, smallest_currency_fraction_value, symbol from tabCurrency - where enabled=1""", - as_dict=1, - update={"doctype": ":Currency"}, - ) - - def update_page_info(bootinfo): bootinfo.page_info.update( { From 7282c8e65b74d327e62ebbfed856781857337cc2 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 5 Jul 2022 12:36:22 +0530 Subject: [PATCH 3/3] fix: test case --- erpnext/manufacturing/doctype/work_order/test_work_order.py | 2 +- erpnext/stock/doctype/stock_entry/stock_entry.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/manufacturing/doctype/work_order/test_work_order.py b/erpnext/manufacturing/doctype/work_order/test_work_order.py index 6bb4cfcead..b556d9974a 100644 --- a/erpnext/manufacturing/doctype/work_order/test_work_order.py +++ b/erpnext/manufacturing/doctype/work_order/test_work_order.py @@ -1243,7 +1243,7 @@ class TestWorkOrder(FrappeTestCase): ste_doc.insert() ste_doc.submit() - batch_list = [row.batch_no for row in ste_doc.items] + batch_list = sorted([row.batch_no for row in ste_doc.items]) wo_doc = make_wo_order_test_record(production_item=fg_item, qty=4) transferred_ste_doc = frappe.get_doc( diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 4b2850e279..46a1e70b05 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -1661,7 +1661,8 @@ class StockEntry(StockController): qty = frappe.utils.ceil(qty) if row.batch_details: - for batch_no, batch_qty in row.batch_details.items(): + batches = sorted(row.batch_details.items(), key=lambda x: x[0]) + for batch_no, batch_qty in batches: if qty <= 0 or batch_qty <= 0: continue