patch fixes
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 28c1f2c..c9001df 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -85,7 +85,6 @@
erpnext.patches.v4_2.recalculate_bom_cost
erpnext.patches.v4_2.fix_gl_entries_for_stock_transactions
erpnext.patches.v4_2.update_requested_and_ordered_qty
-erpnext.patches.v4_2.party_model
erpnext.patches.v4_4.make_email_accounts
execute:frappe.delete_doc("DocType", "Contact Control")
erpnext.patches.v4_2.reset_bom_costs
@@ -98,6 +97,8 @@
erpnext.patches.v5_0.set_default_company_in_bom
erpnext.patches.v5_0.capacity_planning
erpnext.patches.v5_0.rename_table_fieldnames
-erpnext.patches.v5_0.recalculate_total_amount_in_jv
execute:frappe.db.sql("update `tabJournal Entry` set voucher_type='Journal Entry' where ifnull(voucher_type, '')=''")
+erpnext.patches.v4_2.party_model
erpnext.patches.v4_1.fix_jv_remarks
+erpnext.patches.v5_0.recalculate_total_amount_in_jv
+erpnext.patches.v5_0.remove_shopping_cart_app
diff --git a/erpnext/patches/v4_2/party_model.py b/erpnext/patches/v4_2/party_model.py
index d41ef62..8ac4afd 100644
--- a/erpnext/patches/v4_2/party_model.py
+++ b/erpnext/patches/v4_2/party_model.py
@@ -7,8 +7,8 @@
def execute():
frappe.reload_doc("accounts", "doctype", "account")
frappe.reload_doc("setup", "doctype", "company")
- frappe.reload_doc("accounts", "doctype", "journal_entry_account")
frappe.reload_doc("accounts", "doctype", "gl_entry")
+ frappe.reload_doc("accounts", "doctype", "journal_entry_account")
receivable_payable_accounts = create_receivable_payable_account()
if receivable_payable_accounts:
set_party_in_jv_and_gl_entry(receivable_payable_accounts)
diff --git a/erpnext/patches/v5_0/recalculate_total_amount_in_jv.py b/erpnext/patches/v5_0/recalculate_total_amount_in_jv.py
index afb5681..7e6a4a9 100644
--- a/erpnext/patches/v5_0/recalculate_total_amount_in_jv.py
+++ b/erpnext/patches/v5_0/recalculate_total_amount_in_jv.py
@@ -2,14 +2,24 @@
# License: GNU General Public License v3. See license.txt
import frappe
+from frappe.utils import money_in_words
def execute():
- for d in frappe.db.sql("""select name from `tabJournal Entry` where docstatus < 2 """, as_dict=1):
- try:
- jv = frappe.get_doc('Journal Entry', d.name)
- jv.ignore_validate_update_after_submit = True
- jv.set_print_format_fields()
- jv.save()
- frappe.db.commit()
- except:
- frappe.db.rollback()
\ No newline at end of file
+ company_currency = dict(frappe.db.sql("select name, default_currency from `tabCompany`"))
+ bank_or_cash_accounts = frappe.db.sql_list("""select name from `tabAccount`
+ where account_type in ('Bank', 'Cash') and docstatus < 2""")
+
+ for je in frappe.db.sql_list("""select name from `tabJournal Entry` where docstatus < 2"""):
+ total_amount = 0
+ total_amount_in_words = ""
+
+ je_doc = frappe.get_doc('Journal Entry', je)
+ for d in je_doc.get("accounts"):
+ if (d.party_type and d.party) or d.account in bank_or_cash_accounts:
+ total_amount = d.debit or d.credit
+ if total_amount:
+ total_amount_in_words = money_in_words(total_amount, company_currency.get(je_doc.company))
+
+ if total_amount:
+ frappe.db.sql("""update `tabJournal Entry` set total_amount=%s, total_amount_in_words=%s
+ where name = %s""", (total_amount, total_amount_in_words, je))
diff --git a/erpnext/patches/v5_0/remove_shopping_cart_app.py b/erpnext/patches/v5_0/remove_shopping_cart_app.py
new file mode 100644
index 0000000..318f59e
--- /dev/null
+++ b/erpnext/patches/v5_0/remove_shopping_cart_app.py
@@ -0,0 +1,6 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+def execute():
+ from frappe.installer import remove_from_installed_apps
+ remove_from_installed_apps("shopping_cart")
diff --git a/erpnext/patches/v5_0/rename_table_fieldnames.py b/erpnext/patches/v5_0/rename_table_fieldnames.py
index 53d807f..d1e59f2 100644
--- a/erpnext/patches/v5_0/rename_table_fieldnames.py
+++ b/erpnext/patches/v5_0/rename_table_fieldnames.py
@@ -233,7 +233,13 @@
if "tab"+new_dt not in tables:
frappe.rename_doc("DocType", old_dt, new_dt, force=True)
+ # reload new child doctypes
frappe.reload_doc("manufacturing", "doctype", "production_order_operation")
+ frappe.reload_doc("manufacturing", "doctype", "workstation_working_hour")
+ frappe.reload_doc("stock", "doctype", "item_variant")
+ frappe.reload_doc("accounts", "doctype", "party_account")
+ frappe.reload_doc("accounts", "doctype", "fiscal_year_company")
+ frappe.reload_doc("workflow", "doctype", "workflow")
#rename table fieldnames
for dn in rename_map: