From 0e7840301f459005e0003b24578d93df9d45fcb8 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 16 May 2023 13:44:35 +0530 Subject: [PATCH 1/5] perf: cache and simplify queries for holiday list (backport #35315) (#35318) Co-authored-by: Rucha Mahabal --- erpnext/setup/doctype/employee/employee.py | 4 +++- erpnext/setup/doctype/holiday_list/holiday_list.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/erpnext/setup/doctype/employee/employee.py b/erpnext/setup/doctype/employee/employee.py index 13a6f20db29..78f2e4935e7 100755 --- a/erpnext/setup/doctype/employee/employee.py +++ b/erpnext/setup/doctype/employee/employee.py @@ -281,7 +281,9 @@ def get_employee_email(employee_doc): def get_holiday_list_for_employee(employee, raise_exception=True): if employee: - holiday_list, company = frappe.db.get_value("Employee", employee, ["holiday_list", "company"]) + holiday_list, company = frappe.get_cached_value( + "Employee", employee, ["holiday_list", "company"] + ) else: holiday_list = "" company = frappe.db.get_single_value("Global Defaults", "default_company") diff --git a/erpnext/setup/doctype/holiday_list/holiday_list.py b/erpnext/setup/doctype/holiday_list/holiday_list.py index fad827ad8ad..84d0d352871 100644 --- a/erpnext/setup/doctype/holiday_list/holiday_list.py +++ b/erpnext/setup/doctype/holiday_list/holiday_list.py @@ -115,6 +115,8 @@ def is_holiday(holiday_list, date=None): if date is None: date = today() if holiday_list: - return bool(frappe.get_all("Holiday List", dict(name=holiday_list, holiday_date=date))) + return bool( + frappe.db.exists("Holiday", {"parent": holiday_list, "holiday_date": date}, cache=True) + ) else: return False From f8c58b6893ef9b747ffd510ab16bd03666f5f472 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 16 May 2023 16:00:25 +0530 Subject: [PATCH 2/5] fix(UX): misc "home" onboarding improvements (backport #35319) (#35321) fix(UX): misc "home" onboarding improvements (#35319) * fix(UX): cleanup "Home" onboarding - Remove company, letterhead, data import etc from home onboarding step * fix(UX): Show quick entry for item * chore: fix copy here and there (cherry picked from commit 5574d9a72d8e4d372e01035ab44a1254538feb50) Co-authored-by: Ankush Menat --- .../setup/module_onboarding/home/home.json | 19 +++++-------------- .../company_set_up/company_set_up.json | 4 ++-- .../create_a_customer/create_a_customer.json | 6 +++--- .../create_a_quotation.json | 4 ++-- .../create_a_supplier/create_a_supplier.json | 6 +++--- .../create_an_item/create_an_item.json | 8 ++++---- .../data_import/data_import.json | 4 ++-- .../letterhead/letterhead.json | 4 ++-- .../navigation_help/navigation_help.json | 6 +++--- 9 files changed, 26 insertions(+), 35 deletions(-) diff --git a/erpnext/setup/module_onboarding/home/home.json b/erpnext/setup/module_onboarding/home/home.json index f02fc454c00..516f12229c5 100644 --- a/erpnext/setup/module_onboarding/home/home.json +++ b/erpnext/setup/module_onboarding/home/home.json @@ -22,24 +22,18 @@ "creation": "2021-11-22 12:19:15.888642", "docstatus": 0, "doctype": "Module Onboarding", - "documentation_url": "https://docs.erpnext.com/docs/v13/user/manual/en/setting-up/company-setup", + "documentation_url": "https://docs.erpnext.com/docs/v14/user/manual/en/setting-up/company-setup", "idx": 0, "is_complete": 0, - "modified": "2022-06-07 14:31:00.575193", + "modified": "2023-05-16 13:13:24.043792", "modified_by": "Administrator", "module": "Setup", "name": "Home", "owner": "Administrator", "steps": [ - { - "step": "Company Set Up" - }, { "step": "Navigation Help" }, - { - "step": "Data import" - }, { "step": "Create an Item" }, @@ -51,12 +45,9 @@ }, { "step": "Create a Quotation" - }, - { - "step": "Letterhead" } ], - "subtitle": "Company, Item, Customer, Supplier, Navigation Help, Data Import, Letter Head, Quotation", - "success_message": "Masters are all set up!", - "title": "Let's Set Up Some Masters" + "subtitle": "Item, Customer, Supplier, Navigation Help and Quotation", + "success_message": "You're ready to start your journey with ERPNext", + "title": "Let's begin your journey with ERPNext" } \ No newline at end of file diff --git a/erpnext/setup/onboarding_step/company_set_up/company_set_up.json b/erpnext/setup/onboarding_step/company_set_up/company_set_up.json index 6f6583231f9..fae2de01129 100644 --- a/erpnext/setup/onboarding_step/company_set_up/company_set_up.json +++ b/erpnext/setup/onboarding_step/company_set_up/company_set_up.json @@ -5,11 +5,11 @@ "description": "# Set Up a Company\n\nA company is a legal entity for which you will set up your books of account and create accounting transactions. In ERPNext, you can create multiple companies, and establish relationships (group/subsidiary) among them.\n\nWithin the company master, you can capture various default accounts for that Company and set crucial settings related to the accounting methodology followed for a company.\n", "docstatus": 0, "doctype": "Onboarding Step", - "idx": 0, + "idx": 1, "is_complete": 0, "is_single": 0, "is_skipped": 0, - "modified": "2021-12-15 14:22:18.317423", + "modified": "2023-05-15 09:18:42.895537", "modified_by": "Administrator", "name": "Company Set Up", "owner": "Administrator", diff --git a/erpnext/setup/onboarding_step/create_a_customer/create_a_customer.json b/erpnext/setup/onboarding_step/create_a_customer/create_a_customer.json index f74d745be9c..e1a8f908663 100644 --- a/erpnext/setup/onboarding_step/create_a_customer/create_a_customer.json +++ b/erpnext/setup/onboarding_step/create_a_customer/create_a_customer.json @@ -5,17 +5,17 @@ "description": "# Create a Customer\n\nThe Customer master is at the heart of your sales transactions. Customers are linked in Quotations, Sales Orders, Invoices, and Payments. Customers can be either numbered or identified by name (you would typically do this based on the number of customers you have).\n\nThrough Customer\u2019s master, you can effectively track essentials like:\n - Customer\u2019s multiple address and contacts\n - Account Receivables\n - Credit Limit and Credit Period\n", "docstatus": 0, "doctype": "Onboarding Step", - "idx": 0, + "idx": 1, "is_complete": 0, "is_single": 0, "is_skipped": 0, - "modified": "2021-12-15 14:20:31.197564", + "modified": "2023-05-16 12:54:54.112364", "modified_by": "Administrator", "name": "Create a Customer", "owner": "Administrator", "reference_document": "Customer", "show_form_tour": 0, "show_full_form": 0, - "title": "Manage Customers", + "title": "Create a Customer", "validate_action": 1 } \ No newline at end of file diff --git a/erpnext/setup/onboarding_step/create_a_quotation/create_a_quotation.json b/erpnext/setup/onboarding_step/create_a_quotation/create_a_quotation.json index 8bdb621c0a5..92b45b4ff80 100644 --- a/erpnext/setup/onboarding_step/create_a_quotation/create_a_quotation.json +++ b/erpnext/setup/onboarding_step/create_a_quotation/create_a_quotation.json @@ -5,11 +5,11 @@ "description": "# Create a Quotation\n\nLet\u2019s get started with business transactions by creating your first Quotation. You can create a Quotation for an existing customer or a prospect. It will be an approved document, with items you sell and the proposed price + taxes applied. After completing the instructions, you will get a Quotation in a ready to share print format.", "docstatus": 0, "doctype": "Onboarding Step", - "idx": 0, + "idx": 1, "is_complete": 0, "is_single": 0, "is_skipped": 0, - "modified": "2021-12-15 14:21:31.675330", + "modified": "2023-05-15 09:18:42.984170", "modified_by": "Administrator", "name": "Create a Quotation", "owner": "Administrator", diff --git a/erpnext/setup/onboarding_step/create_a_supplier/create_a_supplier.json b/erpnext/setup/onboarding_step/create_a_supplier/create_a_supplier.json index 9574141eaab..ef493fe00d1 100644 --- a/erpnext/setup/onboarding_step/create_a_supplier/create_a_supplier.json +++ b/erpnext/setup/onboarding_step/create_a_supplier/create_a_supplier.json @@ -5,17 +5,17 @@ "description": "# Create a Supplier\n\nAlso known as Vendor, is a master at the center of your purchase transactions. Suppliers are linked in Request for Quotation, Purchase Orders, Receipts, and Payments. Suppliers can be either numbered or identified by name.\n\nThrough Supplier\u2019s master, you can effectively track essentials like:\n - Supplier\u2019s multiple address and contacts\n - Account Receivables\n - Credit Limit and Credit Period\n", "docstatus": 0, "doctype": "Onboarding Step", - "idx": 0, + "idx": 1, "is_complete": 0, "is_single": 0, "is_skipped": 0, - "modified": "2021-12-15 14:21:23.518301", + "modified": "2023-05-16 12:55:08.610113", "modified_by": "Administrator", "name": "Create a Supplier", "owner": "Administrator", "reference_document": "Supplier", "show_form_tour": 0, "show_full_form": 0, - "title": "Manage Suppliers", + "title": "Create a Supplier", "validate_action": 1 } \ No newline at end of file diff --git a/erpnext/setup/onboarding_step/create_an_item/create_an_item.json b/erpnext/setup/onboarding_step/create_an_item/create_an_item.json index cd29683346c..15f36bec81d 100644 --- a/erpnext/setup/onboarding_step/create_an_item/create_an_item.json +++ b/erpnext/setup/onboarding_step/create_an_item/create_an_item.json @@ -6,18 +6,18 @@ "docstatus": 0, "doctype": "Onboarding Step", "form_tour": "Item General", - "idx": 0, + "idx": 1, "intro_video_url": "", "is_complete": 0, "is_single": 0, "is_skipped": 0, - "modified": "2021-12-15 14:19:56.297772", + "modified": "2023-05-16 12:56:40.355878", "modified_by": "Administrator", "name": "Create an Item", "owner": "Administrator", "reference_document": "Item", "show_form_tour": 1, - "show_full_form": 1, - "title": "Manage Items", + "show_full_form": 0, + "title": "Create an Item", "validate_action": 1 } \ No newline at end of file diff --git a/erpnext/setup/onboarding_step/data_import/data_import.json b/erpnext/setup/onboarding_step/data_import/data_import.json index 4999a368d37..e5dd7da29db 100644 --- a/erpnext/setup/onboarding_step/data_import/data_import.json +++ b/erpnext/setup/onboarding_step/data_import/data_import.json @@ -5,11 +5,11 @@ "description": "# Import Data from Spreadsheet\n\nIn ERPNext, you can easily migrate your historical data using spreadsheets. You can use it for migrating not just masters (like Customer, Supplier, Items), but also for transactions like (outstanding invoices, opening stock and accounting entries, etc).", "docstatus": 0, "doctype": "Onboarding Step", - "idx": 0, + "idx": 1, "is_complete": 0, "is_single": 0, "is_skipped": 0, - "modified": "2022-06-07 14:28:51.390813", + "modified": "2023-05-15 09:18:42.962231", "modified_by": "Administrator", "name": "Data import", "owner": "Administrator", diff --git a/erpnext/setup/onboarding_step/letterhead/letterhead.json b/erpnext/setup/onboarding_step/letterhead/letterhead.json index 8e1bb8ce827..584fd481ba1 100644 --- a/erpnext/setup/onboarding_step/letterhead/letterhead.json +++ b/erpnext/setup/onboarding_step/letterhead/letterhead.json @@ -5,11 +5,11 @@ "description": "# Create a Letter Head\n\nA Letter Head contains your organization's name, logo, address, etc which appears at the header and footer portion in documents. You can learn more about Setting up Letter Head in ERPNext here.\n", "docstatus": 0, "doctype": "Onboarding Step", - "idx": 0, + "idx": 1, "is_complete": 0, "is_single": 0, "is_skipped": 0, - "modified": "2021-12-15 14:21:39.037742", + "modified": "2023-05-15 09:18:42.995184", "modified_by": "Administrator", "name": "Letterhead", "owner": "Administrator", diff --git a/erpnext/setup/onboarding_step/navigation_help/navigation_help.json b/erpnext/setup/onboarding_step/navigation_help/navigation_help.json index cf07968bc7f..f57818b9f70 100644 --- a/erpnext/setup/onboarding_step/navigation_help/navigation_help.json +++ b/erpnext/setup/onboarding_step/navigation_help/navigation_help.json @@ -2,14 +2,14 @@ "action": "Watch Video", "action_label": "Learn about Navigation options", "creation": "2021-11-22 12:09:52.233872", - "description": "# Navigation in ERPNext\n\nEase of navigating and browsing around the ERPNext is one of our core strengths. In the following video, you will learn how to reach a specific feature in ERPNext via module page or awesome bar\u2019s shortcut.\n", + "description": "# Navigation in ERPNext\n\nEase of navigating and browsing around the ERPNext is one of our core strengths. In the following video, you will learn how to reach a specific feature in ERPNext via module page or AwesomeBar.", "docstatus": 0, "doctype": "Onboarding Step", - "idx": 0, + "idx": 1, "is_complete": 0, "is_single": 0, "is_skipped": 0, - "modified": "2022-06-07 14:28:00.901082", + "modified": "2023-05-16 12:53:25.939908", "modified_by": "Administrator", "name": "Navigation Help", "owner": "Administrator", From 6f96e5dcd4d066c722bb02b350cb2ddfb8c58770 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 16 May 2023 16:23:52 +0530 Subject: [PATCH 3/5] fix: force to do reposting for cancelled document (cherry picked from commit 6e661e7c0e8251f458d699254423cfb76dc3b5dd) --- erpnext/controllers/stock_controller.py | 3 +++ .../test_repost_item_valuation.py | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py index 09089be8614..befde71775a 100644 --- a/erpnext/controllers/stock_controller.py +++ b/erpnext/controllers/stock_controller.py @@ -770,6 +770,9 @@ class StockController(AccountsController): } ) + if self.docstatus == 2: + force = True + if force or future_sle_exists(args) or repost_required_for_queue(self): item_based_reposting = cint( frappe.db.get_single_value("Stock Reposting Settings", "item_based_reposting") diff --git a/erpnext/stock/doctype/repost_item_valuation/test_repost_item_valuation.py b/erpnext/stock/doctype/repost_item_valuation/test_repost_item_valuation.py index 96ac4352dcd..9c4d997b316 100644 --- a/erpnext/stock/doctype/repost_item_valuation/test_repost_item_valuation.py +++ b/erpnext/stock/doctype/repost_item_valuation/test_repost_item_valuation.py @@ -376,3 +376,19 @@ class TestRepostItemValuation(FrappeTestCase, StockTestMixin): accounts_settings.acc_frozen_upto = "" accounts_settings.save() + + def test_create_repost_entry_for_cancelled_document(self): + pr = make_purchase_receipt( + company="_Test Company with perpetual inventory", + warehouse="Stores - TCP1", + get_multiple_items=True, + ) + + self.assertTrue(pr.docstatus == 1) + self.assertFalse(frappe.db.exists("Repost Item Valuation", {"voucher_no": pr.name})) + + pr.load_from_db() + + pr.cancel() + self.assertTrue(pr.docstatus == 2) + self.assertTrue(frappe.db.exists("Repost Item Valuation", {"voucher_no": pr.name})) From c41e1d7d71a005c894fd737fe6a6a777c879a497 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 16 May 2023 18:58:04 +0530 Subject: [PATCH 4/5] fix: cancelled vouchers in tax withheld vouchers list (#35309) fix: cancelled vouchers in tax withheld vouchers list (#35309) (cherry picked from commit 776a83066db63e84cc6e7dac804c581343f81ccd) Co-authored-by: ruthra kumar --- erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index 5c9168bf9c5..ab7884d5209 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -303,7 +303,7 @@ erpnext.accounts.PurchaseInvoice = class PurchaseInvoice extends erpnext.buying. apply_tds(frm) { var me = this; - + me.frm.set_value("tax_withheld_vouchers", []); if (!me.frm.doc.apply_tds) { me.frm.set_value("tax_withholding_category", ''); me.frm.set_df_property("tax_withholding_category", "hidden", 1); From fa9fa97e05e66dbe3996515ffe70d615d6a49706 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 16 May 2023 18:59:12 +0530 Subject: [PATCH 5/5] fix: unable to create partial invoice with auto fetch terms enabled (#35285) fix: unable to create partial invoice with auto fetch terms enabled (#35285) fix: fetch so/po terms if auto fetch is enabled (cherry picked from commit 0da6c1688b3d37b21d25de81e202e3451fd8dac9) Co-authored-by: ruthra kumar --- erpnext/controllers/accounts_controller.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 3d930d67e04..78bb05671d8 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -1682,6 +1682,9 @@ class AccountsController(TransactionBase): d.base_payment_amount = flt( d.payment_amount * self.get("conversion_rate"), d.precision("base_payment_amount") ) + else: + self.fetch_payment_terms_from_order(po_or_so, doctype) + self.ignore_default_payment_terms_template = 1 def get_order_details(self): if self.doctype == "Sales Invoice":