mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-16 02:11:39 +00:00
Merge branch 'develop' of https://github.com/frappe/erpnext into project-link-for-all-accounts
This commit is contained in:
@@ -4,7 +4,7 @@ import frappe
|
||||
def execute():
|
||||
frappe.reload_doc('accounts', 'doctype', 'bank', force=1)
|
||||
|
||||
if frappe.db.table_exists('Bank') and frappe.db.table_exists('Bank Account'):
|
||||
if frappe.db.table_exists('Bank') and frappe.db.table_exists('Bank Account') and frappe.db.has_column('Bank Account', 'swift_number'):
|
||||
frappe.db.sql("""
|
||||
UPDATE `tabBank` b, `tabBank Account` ba
|
||||
SET b.swift_number = ba.swift_number, b.branch_code = ba.branch_code
|
||||
@@ -12,4 +12,4 @@ def execute():
|
||||
""")
|
||||
|
||||
frappe.reload_doc('accounts', 'doctype', 'bank_account')
|
||||
frappe.reload_doc('accounts', 'doctype', 'payment_request')
|
||||
frappe.reload_doc('accounts', 'doctype', 'payment_request')
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# Copyright (c) 2019, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
''' Move from due_advance_amount to pending_amount '''
|
||||
|
||||
if frappe.db.has_column("Employee Advance", "due_advance_amount"):
|
||||
frappe.db.sql(''' UPDATE `tabEmployee Advance` SET pending_amount=due_advance_amount ''')
|
||||
16
erpnext/patches/v12_0/set_multi_uom_in_rfq.py
Normal file
16
erpnext/patches/v12_0/set_multi_uom_in_rfq.py
Normal file
@@ -0,0 +1,16 @@
|
||||
# Copyright (c) 2017, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.utils import flt
|
||||
from erpnext.stock.get_item_details import get_conversion_factor
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc('buying', 'doctype', 'request_for_quotation_item')
|
||||
|
||||
frappe.db.sql("""UPDATE `tabRequest for Quotation Item`
|
||||
SET
|
||||
stock_uom = uom,
|
||||
conversion_factor = 1,
|
||||
stock_qty = qty""")
|
||||
12
erpnext/patches/v12_0/update_address_template_for_india.py
Normal file
12
erpnext/patches/v12_0/update_address_template_for_india.py
Normal file
@@ -0,0 +1,12 @@
|
||||
# Copyright (c) 2020, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from erpnext.regional.address_template.setup import set_up_address_templates
|
||||
|
||||
def execute():
|
||||
if frappe.db.get_value('Company', {'country': 'India'}, 'name'):
|
||||
address_template = frappe.db.get_value('Address Template', 'India', 'template')
|
||||
if not address_template or "gstin" not in address_template:
|
||||
set_up_address_templates(default_country='India')
|
||||
@@ -14,15 +14,21 @@ def execute():
|
||||
frappe.reload_doc("hr", "doctype", doctype)
|
||||
|
||||
|
||||
standard_tax_exemption_amount_exists = frappe.db.has_column("Payroll Period", "standard_tax_exemption_amount")
|
||||
|
||||
select_fields = "name, start_date, end_date"
|
||||
if standard_tax_exemption_amount_exists:
|
||||
select_fields = "name, start_date, end_date, standard_tax_exemption_amount"
|
||||
|
||||
for company in frappe.get_all("Company"):
|
||||
payroll_periods = frappe.db.sql("""
|
||||
SELECT
|
||||
name, start_date, end_date, standard_tax_exemption_amount
|
||||
{0}
|
||||
FROM
|
||||
`tabPayroll Period`
|
||||
WHERE company=%s
|
||||
ORDER BY start_date DESC
|
||||
""", company.name, as_dict = 1)
|
||||
""".format(select_fields), company.name, as_dict = 1)
|
||||
|
||||
for i, period in enumerate(payroll_periods):
|
||||
income_tax_slab = frappe.new_doc("Income Tax Slab")
|
||||
@@ -36,7 +42,8 @@ def execute():
|
||||
income_tax_slab.effective_from = period.start_date
|
||||
income_tax_slab.company = company.name
|
||||
income_tax_slab.allow_tax_exemption = 1
|
||||
income_tax_slab.standard_tax_exemption_amount = period.standard_tax_exemption_amount
|
||||
if standard_tax_exemption_amount_exists:
|
||||
income_tax_slab.standard_tax_exemption_amount = period.standard_tax_exemption_amount
|
||||
|
||||
income_tax_slab.flags.ignore_mandatory = True
|
||||
income_tax_slab.submit()
|
||||
|
||||
@@ -7,4 +7,4 @@ def execute():
|
||||
for entry in doctypes:
|
||||
if frappe.db.exists('DocType', entry):
|
||||
frappe.reload_doc('Healthcare', 'doctype', entry)
|
||||
frappe.db.sql("update `tab{dt}` set company = '{company}' where ifnull(company, '') = ''".format(dt=entry, company=company))
|
||||
frappe.db.sql("update `tab{dt}` set company = {company} where ifnull(company, '') = ''".format(dt=entry, company=frappe.db.escape(company)))
|
||||
|
||||
93
erpnext/patches/v13_0/update_sla_enhancements.py
Normal file
93
erpnext/patches/v13_0/update_sla_enhancements.py
Normal file
@@ -0,0 +1,93 @@
|
||||
# Copyright (c) 2018, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
# add holiday list and employee group fields in SLA
|
||||
# change response and resolution time in priorities child table
|
||||
if frappe.db.exists('DocType', 'Service Level Agreement'):
|
||||
sla_details = frappe.db.get_all('Service Level Agreement', fields=['name', 'service_level'])
|
||||
priorities = frappe.db.get_all('Service Level Priority', fields=['*'], filters={
|
||||
'parenttype': ('in', ['Service Level Agreement', 'Service Level'])
|
||||
})
|
||||
|
||||
frappe.reload_doc('support', 'doctype', 'service_level_agreement')
|
||||
frappe.reload_doc('support', 'doctype', 'pause_sla_on_status')
|
||||
frappe.reload_doc('support', 'doctype', 'service_level_priority')
|
||||
frappe.reload_doc('support', 'doctype', 'service_day')
|
||||
|
||||
for entry in sla_details:
|
||||
values = frappe.db.get_value('Service Level', entry.service_level, ['holiday_list', 'employee_group'])
|
||||
if values:
|
||||
holiday_list = values[0]
|
||||
employee_group = values[1]
|
||||
frappe.db.set_value('Service Level Agreement', entry.name, {
|
||||
'holiday_list': holiday_list,
|
||||
'employee_group': employee_group
|
||||
})
|
||||
|
||||
priority_dict = {}
|
||||
|
||||
for priority in priorities:
|
||||
if priority.parenttype == 'Service Level Agreement':
|
||||
response_time = convert_to_seconds(priority.response_time, priority.response_time_period)
|
||||
resolution_time = convert_to_seconds(priority.resolution_time, priority.resolution_time_period)
|
||||
frappe.db.set_value('Service Level Priority', priority.name, {
|
||||
'response_time': response_time,
|
||||
'resolution_time': resolution_time
|
||||
})
|
||||
if priority.parenttype == 'Service Level':
|
||||
if not priority.parent in priority_dict:
|
||||
priority_dict[priority.parent] = []
|
||||
priority_dict[priority.parent].append(priority)
|
||||
|
||||
|
||||
# copy Service Levels to Service Level Agreements
|
||||
sl = [entry.service_level for entry in sla_details]
|
||||
if frappe.db.exists('DocType', 'Service Level'):
|
||||
service_levels = frappe.db.get_all('Service Level', filters={'service_level': ('not in', sl)}, fields=['*'])
|
||||
for entry in service_levels:
|
||||
sla = frappe.new_doc('Service Level Agreement')
|
||||
sla.service_level = entry.service_level
|
||||
sla.holiday_list = entry.holiday_list
|
||||
sla.employee_group = entry.employee_group
|
||||
sla.flags.ignore_validate = True
|
||||
sla = sla.insert(ignore_mandatory=True)
|
||||
|
||||
frappe.db.sql("""
|
||||
UPDATE
|
||||
`tabService Day`
|
||||
SET
|
||||
parent = %(new_parent)s , parentfield = 'support_and_resolution', parenttype = 'Service Level Agreement'
|
||||
WHERE
|
||||
parent = %(old_parent)s
|
||||
""", {'new_parent': sla.name, 'old_parent': entry.name}, as_dict = 1)
|
||||
|
||||
priority_list = priority_dict.get(entry.name)
|
||||
if priority_list:
|
||||
sla = frappe.get_doc('Service Level Agreement', sla.name)
|
||||
for priority in priority_list:
|
||||
row = sla.append('priorities', {
|
||||
'priority': priority.priority,
|
||||
'default_priority': priority.default_priority,
|
||||
'response_time': convert_to_seconds(priority.response_time, priority.response_time_period),
|
||||
'resolution_time': convert_to_seconds(priority.resolution_time, priority.resolution_time_period)
|
||||
})
|
||||
row.db_update()
|
||||
sla.db_update()
|
||||
|
||||
frappe.delete_doc_if_exists('DocType', 'Service Level')
|
||||
|
||||
|
||||
def convert_to_seconds(value, unit):
|
||||
seconds = 0
|
||||
if unit == "Hour":
|
||||
seconds = value * 3600
|
||||
if unit == "Day":
|
||||
seconds = value * 3600 * 24
|
||||
if unit == "Week":
|
||||
seconds = value * 3600 * 24 * 7
|
||||
return seconds
|
||||
Reference in New Issue
Block a user