Skip to content

Commit

Permalink
fix: patches were breaking while migrating (frappe#27206)
Browse files Browse the repository at this point in the history
* fix: patches were breaking while migrating (frappe#27195)

* fix: patches were breaking while migrating

* fix: Removed duplicate function

Co-authored-by: Nabin Hait <nabinhait@gmail.com>
(cherry picked from commit 17e0fa7)

# Conflicts:
#	erpnext/patches.txt

* fix: resolve conflicts

Co-authored-by: Shadrak Gurupnor <30501401+shadrak98@users.noreply.github.com>
Co-authored-by: Ankush Menat <ankush@iwebnotes.com>
  • Loading branch information
3 people authored Aug 28, 2021
1 parent 1e97f87 commit ee76032
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion erpnext/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ execute:frappe.delete_doc_if_exists("DocType", "Bank Reconciliation")
erpnext.patches.v13_0.move_doctype_reports_and_notification_from_hr_to_payroll #22-06-2020
erpnext.patches.v13_0.move_payroll_setting_separately_from_hr_settings #22-06-2020
execute:frappe.reload_doc("regional", "doctype", "e_invoice_settings")
erpnext.patches.v12_0.create_itc_reversal_custom_fields
erpnext.patches.v13_0.check_is_income_tax_component #22-06-2020
erpnext.patches.v13_0.loyalty_points_entry_for_pos_invoice #22-07-2020
erpnext.patches.v12_0.add_taxjar_integration_field
Expand Down Expand Up @@ -274,7 +275,6 @@ erpnext.patches.v13_0.rename_discharge_date_in_ip_record
erpnext.patches.v12_0.create_taxable_value_field
erpnext.patches.v12_0.add_gst_category_in_delivery_note
erpnext.patches.v12_0.purchase_receipt_status
erpnext.patches.v12_0.create_itc_reversal_custom_fields
erpnext.patches.v13_0.fix_non_unique_represents_company
erpnext.patches.v12_0.add_document_type_field_for_italy_einvoicing
erpnext.patches.v13_0.make_non_standard_user_type #13-04-2021
Expand Down
4 changes: 2 additions & 2 deletions erpnext/patches/v13_0/check_is_income_tax_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ def execute():
]

for doctype in doctypes:
frappe.reload_doc('Payroll', 'doctype', doctype)
frappe.reload_doc('Payroll', 'doctype', doctype, force=True)


reports = ['Professional Tax Deductions', 'Provident Fund Deductions']
reports = ['Professional Tax Deductions', 'Provident Fund Deductions', 'E-Invoice Summary']
for report in reports:
frappe.reload_doc('Regional', 'Report', report)
frappe.reload_doc('Regional', 'Report', report)
Expand Down
11 changes: 11 additions & 0 deletions erpnext/patches/v13_0/delete_old_purchase_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def execute():
for report in reports_to_delete:
if frappe.db.exists("Report", report):
delete_auto_email_reports(report)
check_linked_reports(report)

frappe.delete_doc("Report", report)

Expand All @@ -21,3 +22,13 @@ def delete_auto_email_reports(report):
auto_email_reports = frappe.db.get_values("Auto Email Report", {"report": report}, ["name"])
for auto_email_report in auto_email_reports:
frappe.delete_doc("Auto Email Report", auto_email_report[0])

def check_linked_reports(report):
""" Check if reports are referenced in Desktop Icon """
icons = frappe.get_all("Desktop Icon",
fields = ['name'],
filters = {
"_report": report
})
if icons:
frappe.delete_doc("Desktop Icon", icons)
2 changes: 2 additions & 0 deletions erpnext/patches/v13_0/delete_old_sales_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
from __future__ import unicode_literals

import frappe
from erpnext.patches.v13_0.delete_old_purchase_reports import check_linked_reports

def execute():
reports_to_delete = ["Ordered Items To Be Delivered", "Ordered Items To Be Billed"]

for report in reports_to_delete:
if frappe.db.exists("Report", report):
delete_auto_email_reports(report)
check_linked_reports(report)

frappe.delete_doc("Report", report)

Expand Down
3 changes: 3 additions & 0 deletions erpnext/patches/v13_0/rename_issue_doctype_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def execute():
rename_field('Opportunity', 'mins_to_first_response', 'first_response_time')

# change fieldtype to duration
frappe.reload_doc('crm', 'doctype', 'opportunity', force=True)
count = 0
for entry in opportunities:
mins_to_first_response = convert_to_seconds(entry.mins_to_first_response, 'Minutes')
Expand All @@ -58,6 +59,8 @@ def execute():

def convert_to_seconds(value, unit):
seconds = 0
if value == 0:
return seconds
if unit == 'Hours':
seconds = value * 3600
if unit == 'Minutes':
Expand Down
1 change: 1 addition & 0 deletions erpnext/patches/v13_0/update_returned_qty_in_pr_dn.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def execute():
frappe.reload_doc('stock', 'doctype', 'purchase_receipt_item')
frappe.reload_doc('stock', 'doctype', 'delivery_note')
frappe.reload_doc('stock', 'doctype', 'delivery_note_item')
frappe.reload_doc('stock', 'doctype', 'stock_settings')

def update_from_return_docs(doctype):
for return_doc in frappe.get_all(doctype, filters={'is_return' : 1, 'docstatus' : 1}):
Expand Down

0 comments on commit ee76032

Please sign in to comment.