fix: remove HR/Payroll patches
This commit is contained in:
parent
c8712b02f9
commit
930e557fc6
@ -6,11 +6,9 @@ erpnext.patches.v11_0.refactor_naming_series
|
||||
erpnext.patches.v11_0.refactor_autoname_naming
|
||||
erpnext.patches.v14_0.change_is_subcontracted_fieldtype
|
||||
execute:frappe.reload_doc("accounts", "doctype", "POS Payment Method") #2020-05-28
|
||||
execute:frappe.reload_doc("HR", "doctype", "HR Settings") #2020-01-16 #2020-07-24
|
||||
erpnext.patches.v4_2.update_requested_and_ordered_qty #2021-03-31
|
||||
erpnext.patches.v5_7.update_item_description_based_on_item_master
|
||||
erpnext.patches.v4_2.repost_reserved_qty #2021-03-31
|
||||
execute:frappe.reload_doc("Payroll", "doctype", "salary_slip")
|
||||
erpnext.patches.v8_1.setup_gst_india #2017-06-27
|
||||
erpnext.patches.v8_1.removed_roles_from_gst_report_non_indian_account #16-08-2018
|
||||
erpnext.patches.v8_7.sync_india_custom_fields
|
||||
@ -18,27 +16,20 @@ erpnext.patches.v10_0.fichier_des_ecritures_comptables_for_france
|
||||
erpnext.patches.v10_0.rename_price_to_rate_in_pricing_rule
|
||||
erpnext.patches.v10_0.set_currency_in_pricing_rule
|
||||
erpnext.patches.v10_0.update_translatable_fields
|
||||
erpnext.patches.v10_0.rename_offer_letter_to_job_offer
|
||||
execute:frappe.delete_doc('DocType', 'Production Planning Tool', ignore_missing=True)
|
||||
erpnext.patches.v10_0.migrate_daily_work_summary_settings_to_daily_work_summary_group # 24-12-2018
|
||||
erpnext.patches.v10_0.add_default_cash_flow_mappers
|
||||
erpnext.patches.v11_0.rename_duplicate_item_code_values
|
||||
erpnext.patches.v11_0.make_quality_inspection_template
|
||||
erpnext.patches.v11_0.merge_land_unit_with_location
|
||||
erpnext.patches.v11_0.add_index_on_nestedset_doctypes
|
||||
erpnext.patches.v11_0.remove_modules_setup_page
|
||||
erpnext.patches.v11_0.move_leave_approvers_from_employee #13-06-2018
|
||||
erpnext.patches.v11_0.update_department_lft_rgt
|
||||
erpnext.patches.v11_0.add_default_email_template_for_leave
|
||||
erpnext.patches.v11_0.set_default_email_template_in_hr #08-06-2018
|
||||
erpnext.patches.v11_0.uom_conversion_data #30-06-2018
|
||||
erpnext.patches.v11_0.update_account_type_in_party_type
|
||||
erpnext.patches.v11_0.rename_supplier_type_to_supplier_group
|
||||
erpnext.patches.v10_1.transfer_subscription_to_auto_repeat
|
||||
erpnext.patches.v11_0.update_brand_in_item_price
|
||||
erpnext.patches.v11_0.create_default_success_action
|
||||
erpnext.patches.v11_0.rename_field_max_days_allowed
|
||||
erpnext.patches.v11_0.create_salary_structure_assignments
|
||||
erpnext.patches.v11_0.rebuild_tree_for_company
|
||||
erpnext.patches.v11_0.create_department_records_for_each_company
|
||||
erpnext.patches.v11_0.make_location_from_warehouse
|
||||
@ -53,10 +44,8 @@ erpnext.patches.v11_0.set_update_field_and_value_in_workflow_state
|
||||
erpnext.patches.v11_0.update_total_qty_field
|
||||
erpnext.patches.v11_0.update_sales_partner_type
|
||||
erpnext.patches.v11_0.rename_asset_adjustment_doctype
|
||||
erpnext.patches.v11_0.set_salary_component_properties
|
||||
erpnext.patches.v11_0.set_user_permissions_for_department
|
||||
erpnext.patches.v11_0.hr_ux_cleanups
|
||||
erpnext.patches.v11_0.skip_user_permission_check_for_department
|
||||
erpnext.patches.v11_0.set_department_for_doctypes
|
||||
erpnext.patches.v11_0.update_allow_transfer_for_manufacture
|
||||
erpnext.patches.v11_0.add_item_group_defaults
|
||||
@ -70,13 +59,11 @@ execute:frappe.delete_doc_if_exists("Page", "purchase-analytics")
|
||||
execute:frappe.delete_doc_if_exists("Page", "stock-analytics")
|
||||
execute:frappe.delete_doc_if_exists("Page", "production-analytics")
|
||||
erpnext.patches.v11_0.ewaybill_fields_gst_india #2018-11-13 #2019-01-09 #2019-04-01 #2019-04-26 #2019-05-03
|
||||
erpnext.patches.v11_0.drop_column_max_days_allowed
|
||||
erpnext.patches.v10_0.item_barcode_childtable_migrate # 16-02-2019
|
||||
erpnext.patches.v11_0.update_delivery_trip_status
|
||||
erpnext.patches.v11_0.set_missing_gst_hsn_code
|
||||
erpnext.patches.v11_0.rename_bom_wo_fields
|
||||
erpnext.patches.v12_0.set_default_homepage_type
|
||||
erpnext.patches.v11_0.rename_additional_salary_component_additional_salary
|
||||
erpnext.patches.v11_0.renamed_from_to_fields_in_project
|
||||
erpnext.patches.v11_0.add_permissions_in_gst_settings #2020-04-04
|
||||
erpnext.patches.v11_1.setup_guardian_role
|
||||
@ -97,7 +84,6 @@ erpnext.patches.v12_0.make_item_manufacturer
|
||||
erpnext.patches.v12_0.move_item_tax_to_item_tax_template
|
||||
erpnext.patches.v11_1.set_variant_based_on
|
||||
erpnext.patches.v11_1.woocommerce_set_creation_user
|
||||
erpnext.patches.v11_1.set_salary_details_submittable
|
||||
erpnext.patches.v11_1.rename_depends_on_lwp
|
||||
execute:frappe.delete_doc("Report", "Inactive Items")
|
||||
erpnext.patches.v11_1.delete_scheduling_tool
|
||||
@ -129,7 +115,6 @@ execute:frappe.reload_doc('desk', 'doctype', 'dashboard_chart_source')
|
||||
execute:frappe.reload_doc('desk', 'doctype', 'dashboard_chart')
|
||||
execute:frappe.reload_doc('desk', 'doctype', 'dashboard_chart_field')
|
||||
erpnext.patches.v12_0.remove_bank_remittance_custom_fields
|
||||
erpnext.patches.v12_0.generate_leave_ledger_entries #04-11-2020
|
||||
execute:frappe.delete_doc_if_exists("Report", "Loan Repayment")
|
||||
erpnext.patches.v12_0.move_credit_limit_to_customer_credit_limit
|
||||
erpnext.patches.v12_0.add_variant_of_in_item_attribute_table
|
||||
@ -143,7 +128,6 @@ erpnext.patches.v12_0.set_automatically_process_deferred_accounting_in_accounts_
|
||||
erpnext.patches.v12_0.set_payment_entry_status
|
||||
erpnext.patches.v12_0.update_owner_fields_in_acc_dimension_custom_fields
|
||||
erpnext.patches.v12_0.add_export_type_field_in_party_master
|
||||
erpnext.patches.v12_0.remove_denied_leaves_from_leave_ledger
|
||||
erpnext.patches.v12_0.update_price_or_product_discount
|
||||
erpnext.patches.v12_0.set_production_capacity_in_workstation
|
||||
erpnext.patches.v12_0.set_employee_preferred_emails
|
||||
@ -152,7 +136,6 @@ erpnext.patches.v12_0.set_cost_center_in_child_table_of_expense_claim
|
||||
erpnext.patches.v12_0.add_eway_bill_in_delivery_note
|
||||
erpnext.patches.v12_0.set_lead_title_field
|
||||
erpnext.patches.v12_0.set_permission_einvoicing
|
||||
erpnext.patches.v12_0.set_job_offer_applicant_email
|
||||
erpnext.patches.v12_0.create_irs_1099_field_united_states
|
||||
erpnext.patches.v12_0.move_bank_account_swift_number_to_bank
|
||||
erpnext.patches.v12_0.rename_bank_reconciliation
|
||||
@ -165,17 +148,11 @@ erpnext.patches.v12_0.recalculate_requested_qty_in_bin
|
||||
erpnext.patches.v12_0.set_total_batch_quantity
|
||||
erpnext.patches.v12_0.rename_mws_settings_fields
|
||||
erpnext.patches.v12_0.set_updated_purpose_in_pick_list
|
||||
erpnext.patches.v12_0.set_default_payroll_based_on
|
||||
erpnext.patches.v12_0.repost_stock_ledger_entries_for_target_warehouse
|
||||
erpnext.patches.v12_0.update_end_date_and_status_in_email_campaign
|
||||
erpnext.patches.v13_0.move_tax_slabs_from_payroll_period_to_income_tax_slab #123
|
||||
erpnext.patches.v12_0.fix_quotation_expired_status
|
||||
erpnext.patches.v12_0.rename_pos_closing_doctype
|
||||
erpnext.patches.v13_0.replace_pos_payment_mode_table #2020-12-29
|
||||
erpnext.patches.v12_0.remove_duplicate_leave_ledger_entries #2020-05-22
|
||||
erpnext.patches.v13_0.patch_to_fix_reverse_linking_in_additional_salary_encashment_and_incentive
|
||||
execute:frappe.reload_doc("HR", "doctype", "Employee Advance")
|
||||
erpnext.patches.v12_0.move_due_advance_amount_to_pending_amount
|
||||
execute:frappe.delete_doc_if_exists("Page", "appointment-analytic")
|
||||
execute:frappe.rename_doc("Desk Page", "Getting Started", "Home", force=True)
|
||||
erpnext.patches.v12_0.unset_customer_supplier_based_on_type_of_item_price
|
||||
@ -202,11 +179,8 @@ erpnext.patches.v13_0.update_deferred_settings
|
||||
erpnext.patches.v12_0.set_multi_uom_in_rfq
|
||||
erpnext.patches.v13_0.delete_old_sales_reports
|
||||
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
|
||||
erpnext.patches.v12_0.create_itc_reversal_custom_fields
|
||||
execute:frappe.reload_doc("regional", "doctype", "e_invoice_settings")
|
||||
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
|
||||
erpnext.patches.v12_0.fix_percent_complete_for_projects
|
||||
@ -218,7 +192,6 @@ erpnext.patches.v13_0.stock_entry_enhancements
|
||||
erpnext.patches.v12_0.update_state_code_for_daman_and_diu
|
||||
erpnext.patches.v12_0.rename_lost_reason_detail
|
||||
erpnext.patches.v13_0.drop_razorpay_payload_column
|
||||
erpnext.patches.v13_0.update_start_end_date_for_old_shift_assignment
|
||||
erpnext.patches.v13_0.setting_custom_roles_for_some_regional_reports
|
||||
erpnext.patches.v13_0.rename_issue_doctype_fields
|
||||
erpnext.patches.v13_0.change_default_pos_print_format
|
||||
@ -227,8 +200,6 @@ erpnext.patches.v13_0.set_app_name
|
||||
erpnext.patches.v13_0.print_uom_after_quantity_patch
|
||||
erpnext.patches.v13_0.set_payment_channel_in_payment_gateway_account
|
||||
erpnext.patches.v12_0.setup_einvoice_fields #2020-12-02
|
||||
erpnext.patches.v13_0.updates_for_multi_currency_payroll
|
||||
erpnext.patches.v13_0.update_reason_for_resignation_in_employee
|
||||
execute:frappe.delete_doc("Report", "Quoted Item Comparison")
|
||||
erpnext.patches.v13_0.update_member_email_address
|
||||
erpnext.patches.v13_0.update_pos_closing_entry_in_merge_log
|
||||
@ -237,7 +208,6 @@ erpnext.patches.v13_0.update_returned_qty_in_pr_dn
|
||||
execute:frappe.rename_doc("Workspace", "Loan", "Loan Management", ignore_if_exists=True, force=True)
|
||||
erpnext.patches.v13_0.create_uae_pos_invoice_fields
|
||||
erpnext.patches.v13_0.update_project_template_tasks
|
||||
erpnext.patches.v13_0.set_company_in_leave_ledger_entry
|
||||
erpnext.patches.v13_0.convert_qi_parameter_to_link_field
|
||||
erpnext.patches.v13_0.add_naming_series_to_old_projects # 1-02-2021
|
||||
erpnext.patches.v13_0.update_payment_terms_outstanding
|
||||
@ -257,16 +227,13 @@ erpnext.patches.v12_0.add_gst_category_in_delivery_note
|
||||
erpnext.patches.v12_0.purchase_receipt_status
|
||||
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 #17-01-2022
|
||||
erpnext.patches.v13_0.update_shipment_status
|
||||
erpnext.patches.v13_0.remove_attribute_field_from_item_variant_setting
|
||||
erpnext.patches.v12_0.add_ewaybill_validity_field
|
||||
erpnext.patches.v13_0.set_pos_closing_as_failed
|
||||
erpnext.patches.v13_0.rename_stop_to_send_birthday_reminders
|
||||
execute:frappe.rename_doc("Workspace", "Loan Management", "Loans", force=True)
|
||||
erpnext.patches.v13_0.update_timesheet_changes
|
||||
erpnext.patches.v13_0.add_doctype_to_sla #14-06-2021
|
||||
erpnext.patches.v13_0.set_training_event_attendance
|
||||
erpnext.patches.v13_0.bill_for_rejected_quantity_in_purchase_invoice
|
||||
erpnext.patches.v13_0.rename_issue_status_hold_to_on_hold
|
||||
erpnext.patches.v13_0.update_response_by_variance
|
||||
@ -304,7 +271,6 @@ erpnext.patches.v13_0.create_custom_field_for_finance_book
|
||||
erpnext.patches.v13_0.modify_invalid_gain_loss_gl_entries #2
|
||||
erpnext.patches.v13_0.fix_additional_cost_in_mfg_stock_entry
|
||||
erpnext.patches.v13_0.set_status_in_maintenance_schedule_table
|
||||
erpnext.patches.v13_0.add_default_interview_notification_templates
|
||||
erpnext.patches.v13_0.enable_scheduler_job_for_item_reposting
|
||||
erpnext.patches.v13_0.requeue_failed_reposts
|
||||
erpnext.patches.v13_0.update_job_card_status
|
||||
@ -322,7 +288,6 @@ erpnext.patches.v13_0.rename_ksa_qr_field
|
||||
erpnext.patches.v13_0.wipe_serial_no_field_for_0_qty
|
||||
erpnext.patches.v13_0.disable_ksa_print_format_for_others # 16-12-2021
|
||||
erpnext.patches.v13_0.update_tax_category_for_rcm
|
||||
erpnext.patches.v14_0.set_payroll_cost_centers
|
||||
erpnext.patches.v13_0.agriculture_deprecation_warning
|
||||
erpnext.patches.v13_0.hospitality_deprecation_warning
|
||||
erpnext.patches.v13_0.update_asset_quantity_field
|
||||
@ -334,7 +299,6 @@ erpnext.patches.v13_0.enable_ksa_vat_docs #1
|
||||
[post_model_sync]
|
||||
execute:frappe.delete_doc_if_exists('Workspace', 'ERPNext Integrations Settings')
|
||||
erpnext.patches.v14_0.rename_ongoing_status_in_sla_documents
|
||||
erpnext.patches.v14_0.add_default_exit_questionnaire_notification_template
|
||||
erpnext.patches.v14_0.delete_shopify_doctypes
|
||||
erpnext.patches.v14_0.delete_healthcare_doctypes
|
||||
erpnext.patches.v14_0.delete_hub_doctypes
|
||||
@ -343,7 +307,6 @@ erpnext.patches.v14_0.delete_agriculture_doctypes
|
||||
erpnext.patches.v14_0.delete_education_doctypes
|
||||
erpnext.patches.v14_0.delete_datev_doctypes
|
||||
erpnext.patches.v14_0.rearrange_company_fields
|
||||
erpnext.patches.v14_0.update_leave_notification_template
|
||||
erpnext.patches.v14_0.restore_einvoice_fields
|
||||
erpnext.patches.v13_0.update_sane_transfer_against
|
||||
erpnext.patches.v12_0.add_company_link_to_einvoice_settings
|
||||
@ -358,20 +321,16 @@ erpnext.patches.v13_0.set_work_order_qty_in_so_from_mr
|
||||
erpnext.patches.v13_0.update_accounts_in_loan_docs
|
||||
erpnext.patches.v14_0.update_batch_valuation_flag
|
||||
erpnext.patches.v14_0.delete_non_profit_doctypes
|
||||
erpnext.patches.v13_0.update_employee_advance_status
|
||||
erpnext.patches.v13_0.add_cost_center_in_loans
|
||||
erpnext.patches.v13_0.set_return_against_in_pos_invoice_references
|
||||
erpnext.patches.v13_0.remove_unknown_links_to_prod_plan_items # 24-03-2022
|
||||
erpnext.patches.v13_0.update_expense_claim_status_for_paid_advances
|
||||
erpnext.patches.v13_0.create_gst_custom_fields_in_quotation
|
||||
erpnext.patches.v13_0.copy_custom_field_filters_to_website_item
|
||||
erpnext.patches.v13_0.change_default_item_manufacturer_fieldtype
|
||||
erpnext.patches.v13_0.requeue_recoverable_reposts
|
||||
erpnext.patches.v14_0.discount_accounting_separation
|
||||
erpnext.patches.v14_0.delete_employee_transfer_property_doctype
|
||||
erpnext.patches.v13_0.create_accounting_dimensions_in_orders
|
||||
erpnext.patches.v13_0.set_per_billed_in_return_delivery_note
|
||||
execute:frappe.delete_doc("DocType", "Naming Series")
|
||||
erpnext.patches.v13_0.set_payroll_entry_status
|
||||
erpnext.patches.v13_0.job_card_status_on_hold
|
||||
erpnext.patches.v14_0.delete_hr_payroll_doctypes
|
@ -1,58 +0,0 @@
|
||||
# Copyright (c) 2018, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
if not frappe.db.table_exists("Daily Work Summary Group"):
|
||||
frappe.reload_doc("hr", "doctype", "daily_work_summary_group")
|
||||
frappe.reload_doc("hr", "doctype", "daily_work_summary_group_user")
|
||||
|
||||
# check if Daily Work Summary Settings Company table exists
|
||||
try:
|
||||
frappe.db.sql("DESC `tabDaily Work Summary Settings Company`")
|
||||
except Exception:
|
||||
return
|
||||
|
||||
# get the previously saved settings
|
||||
previous_setting = get_previous_setting()
|
||||
if previous_setting["companies"]:
|
||||
for d in previous_setting["companies"]:
|
||||
users = frappe.get_list(
|
||||
"Employee", dict(company=d.company, user_id=("!=", " ")), "user_id as user"
|
||||
)
|
||||
if len(users):
|
||||
# create new group entry for each company entry
|
||||
new_group = frappe.get_doc(
|
||||
dict(
|
||||
doctype="Daily Work Summary Group",
|
||||
name="Daily Work Summary for " + d.company,
|
||||
users=users,
|
||||
send_emails_at=d.send_emails_at,
|
||||
subject=previous_setting["subject"],
|
||||
message=previous_setting["message"],
|
||||
)
|
||||
)
|
||||
new_group.flags.ignore_permissions = True
|
||||
new_group.flags.ignore_validate = True
|
||||
new_group.insert(ignore_if_duplicate=True)
|
||||
|
||||
frappe.delete_doc("DocType", "Daily Work Summary Settings")
|
||||
frappe.delete_doc("DocType", "Daily Work Summary Settings Company")
|
||||
|
||||
|
||||
def get_previous_setting():
|
||||
obj = {}
|
||||
setting_data = frappe.db.sql(
|
||||
"select field, value from tabSingles where doctype='Daily Work Summary Settings'"
|
||||
)
|
||||
for field, value in setting_data:
|
||||
obj[field] = value
|
||||
obj["companies"] = get_setting_companies()
|
||||
return obj
|
||||
|
||||
|
||||
def get_setting_companies():
|
||||
return frappe.db.sql("select * from `tabDaily Work Summary Settings Company`", as_dict=True)
|
@ -1,10 +0,0 @@
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
if frappe.db.table_exists("Offer Letter") and not frappe.db.table_exists("Job Offer"):
|
||||
frappe.rename_doc("DocType", "Offer Letter", "Job Offer", force=True)
|
||||
frappe.rename_doc("DocType", "Offer Letter Term", "Job Offer Term", force=True)
|
||||
frappe.reload_doc("hr", "doctype", "job_offer")
|
||||
frappe.reload_doc("hr", "doctype", "job_offer_term")
|
||||
frappe.delete_doc("Print Format", "Offer Letter")
|
@ -1,38 +0,0 @@
|
||||
import os
|
||||
|
||||
import frappe
|
||||
from frappe import _
|
||||
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("email", "doctype", "email_template")
|
||||
|
||||
if not frappe.db.exists("Email Template", _("Leave Approval Notification")):
|
||||
base_path = frappe.get_app_path("erpnext", "hr", "doctype")
|
||||
response = frappe.read_file(
|
||||
os.path.join(base_path, "leave_application/leave_application_email_template.html")
|
||||
)
|
||||
frappe.get_doc(
|
||||
{
|
||||
"doctype": "Email Template",
|
||||
"name": _("Leave Approval Notification"),
|
||||
"response": response,
|
||||
"subject": _("Leave Approval Notification"),
|
||||
"owner": frappe.session.user,
|
||||
}
|
||||
).insert(ignore_permissions=True)
|
||||
|
||||
if not frappe.db.exists("Email Template", _("Leave Status Notification")):
|
||||
base_path = frappe.get_app_path("erpnext", "hr", "doctype")
|
||||
response = frappe.read_file(
|
||||
os.path.join(base_path, "leave_application/leave_application_email_template.html")
|
||||
)
|
||||
frappe.get_doc(
|
||||
{
|
||||
"doctype": "Email Template",
|
||||
"name": _("Leave Status Notification"),
|
||||
"response": response,
|
||||
"subject": _("Leave Status Notification"),
|
||||
"owner": frappe.session.user,
|
||||
}
|
||||
).insert(ignore_permissions=True)
|
@ -1,91 +0,0 @@
|
||||
# Copyright (c) 2017, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
import frappe
|
||||
from frappe.utils import getdate
|
||||
|
||||
from erpnext.payroll.doctype.salary_structure_assignment.salary_structure_assignment import (
|
||||
DuplicateAssignment,
|
||||
)
|
||||
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("Payroll", "doctype", "Salary Structure")
|
||||
frappe.reload_doc("Payroll", "doctype", "Salary Structure Assignment")
|
||||
frappe.db.sql(
|
||||
"""
|
||||
delete from `tabSalary Structure Assignment`
|
||||
where salary_structure in (select name from `tabSalary Structure` where is_active='No' or docstatus!=1)
|
||||
"""
|
||||
)
|
||||
if frappe.db.table_exists("Salary Structure Employee"):
|
||||
ss_details = frappe.db.sql(
|
||||
"""
|
||||
select sse.employee, sse.employee_name, sse.from_date, sse.to_date,
|
||||
sse.base, sse.variable, sse.parent as salary_structure, ss.company
|
||||
from `tabSalary Structure Employee` sse, `tabSalary Structure` ss
|
||||
where ss.name = sse.parent AND ss.is_active='Yes'
|
||||
AND sse.employee in (select name from `tabEmployee` where ifNull(status, '') != 'Left')""",
|
||||
as_dict=1,
|
||||
)
|
||||
else:
|
||||
cols = ""
|
||||
if "base" in frappe.db.get_table_columns("Salary Structure"):
|
||||
cols = ", base, variable"
|
||||
|
||||
ss_details = frappe.db.sql(
|
||||
"""
|
||||
select name as salary_structure, employee, employee_name, from_date, to_date, company {0}
|
||||
from `tabSalary Structure`
|
||||
where is_active='Yes'
|
||||
AND employee in (select name from `tabEmployee` where ifNull(status, '') != 'Left')
|
||||
""".format(
|
||||
cols
|
||||
),
|
||||
as_dict=1,
|
||||
)
|
||||
|
||||
all_companies = frappe.db.get_all("Company", fields=["name", "default_currency"])
|
||||
for d in all_companies:
|
||||
company = d.name
|
||||
company_currency = d.default_currency
|
||||
|
||||
frappe.db.sql(
|
||||
"""update `tabSalary Structure` set currency = %s where company=%s""",
|
||||
(company_currency, company),
|
||||
)
|
||||
|
||||
for d in ss_details:
|
||||
try:
|
||||
joining_date, relieving_date = frappe.db.get_value(
|
||||
"Employee", d.employee, ["date_of_joining", "relieving_date"]
|
||||
)
|
||||
from_date = d.from_date
|
||||
if joining_date and getdate(from_date) < joining_date:
|
||||
from_date = joining_date
|
||||
elif relieving_date and getdate(from_date) > relieving_date:
|
||||
continue
|
||||
company_currency = frappe.db.get_value("Company", d.company, "default_currency")
|
||||
|
||||
s = frappe.new_doc("Salary Structure Assignment")
|
||||
s.employee = d.employee
|
||||
s.employee_name = d.employee_name
|
||||
s.salary_structure = d.salary_structure
|
||||
s.from_date = from_date
|
||||
s.to_date = d.to_date if isinstance(d.to_date, datetime) else None
|
||||
s.base = d.get("base")
|
||||
s.variable = d.get("variable")
|
||||
s.company = d.company
|
||||
s.currency = company_currency
|
||||
|
||||
# to migrate the data of the old employees
|
||||
s.flags.old_employee = True
|
||||
s.save()
|
||||
s.submit()
|
||||
except DuplicateAssignment:
|
||||
pass
|
||||
|
||||
frappe.db.sql("update `tabSalary Structure` set docstatus=1")
|
@ -1,7 +0,0 @@
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
if frappe.db.exists("DocType", "Leave Type"):
|
||||
if "max_days_allowed" in frappe.db.get_table_columns("Leave Type"):
|
||||
frappe.db.sql("alter table `tabLeave Type` drop column max_days_allowed")
|
@ -1,34 +0,0 @@
|
||||
import frappe
|
||||
from frappe.model.utils.rename_field import rename_field
|
||||
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("hr", "doctype", "department_approver")
|
||||
frappe.reload_doc("hr", "doctype", "employee")
|
||||
frappe.reload_doc("hr", "doctype", "department")
|
||||
|
||||
if frappe.db.has_column("Department", "leave_approver"):
|
||||
rename_field("Department", "leave_approver", "leave_approvers")
|
||||
|
||||
if frappe.db.has_column("Department", "expense_approver"):
|
||||
rename_field("Department", "expense_approver", "expense_approvers")
|
||||
|
||||
if not frappe.db.table_exists("Employee Leave Approver"):
|
||||
return
|
||||
|
||||
approvers = frappe.db.sql(
|
||||
"""select distinct app.leave_approver, emp.department from
|
||||
`tabEmployee Leave Approver` app, `tabEmployee` emp
|
||||
where app.parenttype = 'Employee'
|
||||
and emp.name = app.parent
|
||||
""",
|
||||
as_dict=True,
|
||||
)
|
||||
|
||||
for record in approvers:
|
||||
if record.department:
|
||||
department = frappe.get_doc("Department", record.department)
|
||||
if not department:
|
||||
return
|
||||
if not len(department.leave_approvers):
|
||||
department.append("leave_approvers", {"approver": record.leave_approver}).db_insert()
|
@ -1,11 +0,0 @@
|
||||
import frappe
|
||||
|
||||
# this patch should have been included with this PR https://github.com/frappe/erpnext/pull/14302
|
||||
|
||||
|
||||
def execute():
|
||||
if frappe.db.table_exists("Additional Salary Component"):
|
||||
if not frappe.db.table_exists("Additional Salary"):
|
||||
frappe.rename_doc("DocType", "Additional Salary Component", "Additional Salary")
|
||||
|
||||
frappe.delete_doc("DocType", "Additional Salary Component")
|
@ -1,15 +0,0 @@
|
||||
import frappe
|
||||
from frappe.model.utils.rename_field import rename_field
|
||||
|
||||
|
||||
def execute():
|
||||
frappe.db.sql(
|
||||
"""
|
||||
UPDATE `tabLeave Type`
|
||||
SET max_days_allowed = '0'
|
||||
WHERE trim(coalesce(max_days_allowed, '')) = ''
|
||||
"""
|
||||
)
|
||||
frappe.db.sql_ddl("""ALTER table `tabLeave Type` modify max_days_allowed int(8) NOT NULL""")
|
||||
frappe.reload_doc("hr", "doctype", "leave_type")
|
||||
rename_field("Leave Type", "max_days_allowed", "max_continuous_days_allowed")
|
@ -1,9 +0,0 @@
|
||||
import frappe
|
||||
from frappe import _
|
||||
|
||||
|
||||
def execute():
|
||||
hr_settings = frappe.get_single("HR Settings")
|
||||
hr_settings.leave_approval_notification_template = _("Leave Approval Notification")
|
||||
hr_settings.leave_status_notification_template = _("Leave Status Notification")
|
||||
hr_settings.save()
|
@ -6,19 +6,6 @@ import frappe
|
||||
def execute():
|
||||
|
||||
doctypes_to_update = {
|
||||
"hr": [
|
||||
"Appraisal",
|
||||
"Leave Allocation",
|
||||
"Expense Claim",
|
||||
"Salary Slip",
|
||||
"Attendance",
|
||||
"Training Feedback",
|
||||
"Training Result Employee",
|
||||
"Leave Application",
|
||||
"Employee Advance",
|
||||
"Training Event Employee",
|
||||
"Payroll Employee Detail",
|
||||
],
|
||||
"projects": ["Activity Cost", "Timesheet"],
|
||||
"setup": ["Sales Person"],
|
||||
}
|
||||
|
@ -1,22 +0,0 @@
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("Payroll", "doctype", "salary_detail")
|
||||
frappe.reload_doc("Payroll", "doctype", "salary_component")
|
||||
|
||||
frappe.db.sql("update `tabSalary Component` set is_tax_applicable=1 where type='Earning'")
|
||||
|
||||
frappe.db.sql(
|
||||
"""update `tabSalary Component` set variable_based_on_taxable_salary=1
|
||||
where type='Deduction' and name in ('TDS', 'Tax Deducted at Source')"""
|
||||
)
|
||||
|
||||
frappe.db.sql(
|
||||
"""update `tabSalary Detail` set is_tax_applicable=1
|
||||
where parentfield='earnings' and statistical_component=0"""
|
||||
)
|
||||
frappe.db.sql(
|
||||
"""update `tabSalary Detail` set variable_based_on_taxable_salary=1
|
||||
where parentfield='deductions' and salary_component in ('TDS', 'Tax Deducted at Source')"""
|
||||
)
|
@ -1,85 +0,0 @@
|
||||
import frappe
|
||||
from frappe.desk.form.linked_with import get_linked_doctypes
|
||||
|
||||
# Skips user permission check for doctypes where department link field was recently added
|
||||
# https://github.com/frappe/erpnext/pull/14121
|
||||
|
||||
|
||||
def execute():
|
||||
doctypes_to_skip = []
|
||||
for doctype in [
|
||||
"Appraisal",
|
||||
"Leave Allocation",
|
||||
"Expense Claim",
|
||||
"Instructor",
|
||||
"Salary Slip",
|
||||
"Attendance",
|
||||
"Training Feedback",
|
||||
"Training Result Employee",
|
||||
"Leave Application",
|
||||
"Employee Advance",
|
||||
"Activity Cost",
|
||||
"Training Event Employee",
|
||||
"Timesheet",
|
||||
"Sales Person",
|
||||
"Payroll Employee Detail",
|
||||
]:
|
||||
if frappe.db.exists("Custom Field", {"dt": doctype, "fieldname": "department"}):
|
||||
continue
|
||||
doctypes_to_skip.append(doctype)
|
||||
|
||||
frappe.reload_doctype("User Permission")
|
||||
|
||||
user_permissions = frappe.get_all(
|
||||
"User Permission",
|
||||
filters=[["allow", "=", "Department"], ["applicable_for", "in", [None] + doctypes_to_skip]],
|
||||
fields=["name", "applicable_for"],
|
||||
)
|
||||
|
||||
user_permissions_to_delete = []
|
||||
new_user_permissions_list = []
|
||||
|
||||
for user_permission in user_permissions:
|
||||
if user_permission.applicable_for:
|
||||
# simply delete user permission record since it needs to be skipped.
|
||||
user_permissions_to_delete.append(user_permission.name)
|
||||
else:
|
||||
# if applicable_for is `None` it means that user permission is applicable for every doctype
|
||||
# to avoid this we need to create other user permission records and only skip the listed doctypes in this patch
|
||||
linked_doctypes = get_linked_doctypes(user_permission.allow, True).keys()
|
||||
applicable_for_doctypes = list(set(linked_doctypes) - set(doctypes_to_skip))
|
||||
|
||||
user_permissions_to_delete.append(user_permission.name)
|
||||
|
||||
for doctype in applicable_for_doctypes:
|
||||
if doctype:
|
||||
# Maintain sequence (name, user, allow, for_value, applicable_for, apply_to_all_doctypes)
|
||||
new_user_permissions_list.append(
|
||||
(
|
||||
frappe.generate_hash("", 10),
|
||||
user_permission.user,
|
||||
user_permission.allow,
|
||||
user_permission.for_value,
|
||||
doctype,
|
||||
0,
|
||||
)
|
||||
)
|
||||
|
||||
if new_user_permissions_list:
|
||||
frappe.db.sql(
|
||||
"""
|
||||
INSERT INTO `tabUser Permission`
|
||||
(`name`, `user`, `allow`, `for_value`, `applicable_for`, `apply_to_all_doctypes`)
|
||||
VALUES {}""".format(
|
||||
", ".join(["%s"] * len(new_user_permissions_list))
|
||||
), # nosec
|
||||
tuple(new_user_permissions_list),
|
||||
)
|
||||
|
||||
if user_permissions_to_delete:
|
||||
frappe.db.sql(
|
||||
"DELETE FROM `tabUser Permission` WHERE `name` IN ({})".format( # nosec
|
||||
",".join(["%s"] * len(user_permissions_to_delete))
|
||||
),
|
||||
tuple(user_permissions_to_delete),
|
||||
)
|
@ -5,7 +5,7 @@ from frappe.utils.nestedset import rebuild_tree
|
||||
|
||||
def execute():
|
||||
"""assign lft and rgt appropriately"""
|
||||
frappe.reload_doc("hr", "doctype", "department")
|
||||
frappe.reload_doc("setup", "doctype", "department")
|
||||
if not frappe.db.exists("Department", _("All Departments")):
|
||||
frappe.get_doc(
|
||||
{"doctype": "Department", "department_name": _("All Departments"), "is_group": 1}
|
||||
|
@ -1,14 +0,0 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
|
||||
import frappe
|
||||
from frappe import scrub
|
||||
from frappe.model.utils.rename_field import rename_field
|
||||
|
||||
|
||||
def execute():
|
||||
for doctype in ("Salary Component", "Salary Detail"):
|
||||
if "depends_on_lwp" in frappe.db.get_table_columns(doctype):
|
||||
frappe.reload_doc("Payroll", "doctype", scrub(doctype))
|
||||
rename_field(doctype, "depends_on_lwp", "depends_on_payment_days")
|
@ -1,11 +0,0 @@
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
frappe.db.sql(
|
||||
"""
|
||||
update `tabSalary Structure` ss, `tabSalary Detail` sd
|
||||
set sd.docstatus=1
|
||||
where ss.name=sd.parent and ss.docstatus=1 and sd.parenttype='Salary Structure'
|
||||
"""
|
||||
)
|
@ -1,100 +0,0 @@
|
||||
# Copyright (c) 2018, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
|
||||
import frappe
|
||||
from frappe.utils import getdate, today
|
||||
|
||||
|
||||
def execute():
|
||||
"""Generates leave ledger entries for leave allocation/application/encashment
|
||||
for last allocation"""
|
||||
frappe.reload_doc("HR", "doctype", "Leave Ledger Entry")
|
||||
frappe.reload_doc("HR", "doctype", "Leave Encashment")
|
||||
frappe.reload_doc("HR", "doctype", "Leave Type")
|
||||
|
||||
if not frappe.get_meta("Leave Allocation").has_field("unused_leaves"):
|
||||
frappe.reload_doc("HR", "doctype", "Leave Allocation")
|
||||
update_leave_allocation_fieldname()
|
||||
|
||||
generate_allocation_ledger_entries()
|
||||
generate_application_leave_ledger_entries()
|
||||
generate_encashment_leave_ledger_entries()
|
||||
generate_expiry_allocation_ledger_entries()
|
||||
|
||||
|
||||
def update_leave_allocation_fieldname():
|
||||
"""maps data from old field to the new field"""
|
||||
frappe.db.sql(
|
||||
"""
|
||||
UPDATE `tabLeave Allocation`
|
||||
SET `unused_leaves` = `carry_forwarded_leaves`
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def generate_allocation_ledger_entries():
|
||||
"""fix ledger entries for missing leave allocation transaction"""
|
||||
allocation_list = get_allocation_records()
|
||||
|
||||
for allocation in allocation_list:
|
||||
if not frappe.db.exists(
|
||||
"Leave Ledger Entry",
|
||||
{"transaction_type": "Leave Allocation", "transaction_name": allocation.name},
|
||||
):
|
||||
allocation_obj = frappe.get_doc("Leave Allocation", allocation)
|
||||
allocation_obj.create_leave_ledger_entry()
|
||||
|
||||
|
||||
def generate_application_leave_ledger_entries():
|
||||
"""fix ledger entries for missing leave application transaction"""
|
||||
leave_applications = get_leaves_application_records()
|
||||
|
||||
for application in leave_applications:
|
||||
if not frappe.db.exists(
|
||||
"Leave Ledger Entry",
|
||||
{"transaction_type": "Leave Application", "transaction_name": application.name},
|
||||
):
|
||||
frappe.get_doc("Leave Application", application.name).create_leave_ledger_entry()
|
||||
|
||||
|
||||
def generate_encashment_leave_ledger_entries():
|
||||
"""fix ledger entries for missing leave encashment transaction"""
|
||||
leave_encashments = get_leave_encashment_records()
|
||||
|
||||
for encashment in leave_encashments:
|
||||
if not frappe.db.exists(
|
||||
"Leave Ledger Entry",
|
||||
{"transaction_type": "Leave Encashment", "transaction_name": encashment.name},
|
||||
):
|
||||
frappe.get_doc("Leave Encashment", encashment).create_leave_ledger_entry()
|
||||
|
||||
|
||||
def generate_expiry_allocation_ledger_entries():
|
||||
"""fix ledger entries for missing leave allocation transaction"""
|
||||
from erpnext.hr.doctype.leave_ledger_entry.leave_ledger_entry import expire_allocation
|
||||
|
||||
allocation_list = get_allocation_records()
|
||||
|
||||
for allocation in allocation_list:
|
||||
if not frappe.db.exists(
|
||||
"Leave Ledger Entry",
|
||||
{"transaction_type": "Leave Allocation", "transaction_name": allocation.name, "is_expired": 1},
|
||||
):
|
||||
allocation_obj = frappe.get_doc("Leave Allocation", allocation)
|
||||
if allocation_obj.to_date <= getdate(today()):
|
||||
expire_allocation(allocation_obj)
|
||||
|
||||
|
||||
def get_allocation_records():
|
||||
return frappe.get_all(
|
||||
"Leave Allocation", filters={"docstatus": 1}, fields=["name"], order_by="to_date ASC"
|
||||
)
|
||||
|
||||
|
||||
def get_leaves_application_records():
|
||||
return frappe.get_all("Leave Application", filters={"docstatus": 1}, fields=["name"])
|
||||
|
||||
|
||||
def get_leave_encashment_records():
|
||||
return frappe.get_all("Leave Encashment", filters={"docstatus": 1}, fields=["name"])
|
@ -1,12 +0,0 @@
|
||||
# Copyright (c) 2019, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
|
||||
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 """)
|
@ -1,35 +0,0 @@
|
||||
# Copyright (c) 2018, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
"""Delete leave ledger entry created
|
||||
via leave applications with status != Approved"""
|
||||
if not frappe.db.a_row_exists("Leave Ledger Entry"):
|
||||
return
|
||||
|
||||
leave_application_list = get_denied_leave_application_list()
|
||||
if leave_application_list:
|
||||
delete_denied_leaves_from_leave_ledger_entry(leave_application_list)
|
||||
|
||||
|
||||
def get_denied_leave_application_list():
|
||||
return frappe.db.sql_list(
|
||||
""" Select name from `tabLeave Application` where status <> 'Approved' """
|
||||
)
|
||||
|
||||
|
||||
def delete_denied_leaves_from_leave_ledger_entry(leave_application_list):
|
||||
if leave_application_list:
|
||||
frappe.db.sql(
|
||||
""" Delete
|
||||
FROM `tabLeave Ledger Entry`
|
||||
WHERE
|
||||
transaction_type = 'Leave Application'
|
||||
AND transaction_name in (%s) """
|
||||
% (", ".join(["%s"] * len(leave_application_list))), # nosec
|
||||
tuple(leave_application_list),
|
||||
)
|
@ -1,55 +0,0 @@
|
||||
# Copyright (c) 2018, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
"""Delete duplicate leave ledger entries of type allocation created."""
|
||||
frappe.reload_doc("hr", "doctype", "leave_ledger_entry")
|
||||
if not frappe.db.a_row_exists("Leave Ledger Entry"):
|
||||
return
|
||||
|
||||
duplicate_records_list = get_duplicate_records()
|
||||
delete_duplicate_ledger_entries(duplicate_records_list)
|
||||
|
||||
|
||||
def get_duplicate_records():
|
||||
"""Fetch all but one duplicate records from the list of expired leave allocation."""
|
||||
return frappe.db.sql(
|
||||
"""
|
||||
SELECT name, employee, transaction_name, leave_type, is_carry_forward, from_date, to_date
|
||||
FROM `tabLeave Ledger Entry`
|
||||
WHERE
|
||||
transaction_type = 'Leave Allocation'
|
||||
AND docstatus = 1
|
||||
AND is_expired = 1
|
||||
GROUP BY
|
||||
employee, transaction_name, leave_type, is_carry_forward, from_date, to_date
|
||||
HAVING
|
||||
count(name) > 1
|
||||
ORDER BY
|
||||
creation
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def delete_duplicate_ledger_entries(duplicate_records_list):
|
||||
"""Delete duplicate leave ledger entries."""
|
||||
if not duplicate_records_list:
|
||||
return
|
||||
for d in duplicate_records_list:
|
||||
frappe.db.sql(
|
||||
"""
|
||||
DELETE FROM `tabLeave Ledger Entry`
|
||||
WHERE name != %s
|
||||
AND employee = %s
|
||||
AND transaction_name = %s
|
||||
AND leave_type = %s
|
||||
AND is_carry_forward = %s
|
||||
AND from_date = %s
|
||||
AND to_date = %s
|
||||
""",
|
||||
tuple(d),
|
||||
)
|
@ -1,6 +0,0 @@
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("hr", "doctype", "hr_settings")
|
||||
frappe.db.set_value("HR Settings", None, "payroll_based_on", "Leave")
|
@ -1,14 +0,0 @@
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("hr", "doctype", "job_offer")
|
||||
|
||||
frappe.db.sql(
|
||||
"""
|
||||
UPDATE
|
||||
`tabJob Offer` AS offer
|
||||
SET
|
||||
applicant_email = (SELECT email_id FROM `tabJob Applicant` WHERE name = offer.job_applicant)
|
||||
"""
|
||||
)
|
@ -1,44 +0,0 @@
|
||||
import os
|
||||
|
||||
import frappe
|
||||
from frappe import _
|
||||
|
||||
|
||||
def execute():
|
||||
if not frappe.db.exists("Email Template", _("Interview Reminder")):
|
||||
base_path = frappe.get_app_path("erpnext", "hr", "doctype")
|
||||
response = frappe.read_file(
|
||||
os.path.join(base_path, "interview/interview_reminder_notification_template.html")
|
||||
)
|
||||
|
||||
frappe.get_doc(
|
||||
{
|
||||
"doctype": "Email Template",
|
||||
"name": _("Interview Reminder"),
|
||||
"response": response,
|
||||
"subject": _("Interview Reminder"),
|
||||
"owner": frappe.session.user,
|
||||
}
|
||||
).insert(ignore_permissions=True)
|
||||
|
||||
if not frappe.db.exists("Email Template", _("Interview Feedback Reminder")):
|
||||
base_path = frappe.get_app_path("erpnext", "hr", "doctype")
|
||||
response = frappe.read_file(
|
||||
os.path.join(base_path, "interview/interview_feedback_reminder_template.html")
|
||||
)
|
||||
|
||||
frappe.get_doc(
|
||||
{
|
||||
"doctype": "Email Template",
|
||||
"name": _("Interview Feedback Reminder"),
|
||||
"response": response,
|
||||
"subject": _("Interview Feedback Reminder"),
|
||||
"owner": frappe.session.user,
|
||||
}
|
||||
).insert(ignore_permissions=True)
|
||||
|
||||
hr_settings = frappe.get_doc("HR Settings")
|
||||
hr_settings.interview_reminder_template = _("Interview Reminder")
|
||||
hr_settings.feedback_reminder_notification_template = _("Interview Feedback Reminder")
|
||||
hr_settings.flags.ignore_links = True
|
||||
hr_settings.save()
|
@ -1,62 +0,0 @@
|
||||
# Copyright (c) 2019, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
|
||||
import frappe
|
||||
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
|
||||
|
||||
import erpnext
|
||||
|
||||
|
||||
def execute():
|
||||
|
||||
doctypes = [
|
||||
"salary_component",
|
||||
"Employee Tax Exemption Declaration",
|
||||
"Employee Tax Exemption Proof Submission",
|
||||
"Employee Tax Exemption Declaration Category",
|
||||
"Employee Tax Exemption Proof Submission Detail",
|
||||
"gratuity_rule",
|
||||
"gratuity_rule_slab",
|
||||
"gratuity_applicable_component",
|
||||
]
|
||||
|
||||
for doctype in doctypes:
|
||||
frappe.reload_doc("Payroll", "doctype", doctype, force=True)
|
||||
|
||||
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)
|
||||
|
||||
if erpnext.get_region() == "India":
|
||||
create_custom_field(
|
||||
"Salary Component",
|
||||
dict(
|
||||
fieldname="component_type",
|
||||
label="Component Type",
|
||||
fieldtype="Select",
|
||||
insert_after="description",
|
||||
options="\nProvident Fund\nAdditional Provident Fund\nProvident Fund Loan\nProfessional Tax",
|
||||
depends_on='eval:doc.type == "Deduction"',
|
||||
),
|
||||
)
|
||||
|
||||
if frappe.db.exists("Salary Component", "Income Tax"):
|
||||
frappe.db.set_value("Salary Component", "Income Tax", "is_income_tax_component", 1)
|
||||
if frappe.db.exists("Salary Component", "TDS"):
|
||||
frappe.db.set_value("Salary Component", "TDS", "is_income_tax_component", 1)
|
||||
|
||||
components = frappe.db.sql(
|
||||
"select name from `tabSalary Component` where variable_based_on_taxable_salary = 1", as_dict=1
|
||||
)
|
||||
for component in components:
|
||||
frappe.db.set_value("Salary Component", component.name, "is_income_tax_component", 1)
|
||||
|
||||
if erpnext.get_region() == "India":
|
||||
if frappe.db.exists("Salary Component", "Provident Fund"):
|
||||
frappe.db.set_value("Salary Component", "Provident Fund", "component_type", "Provident Fund")
|
||||
if frappe.db.exists("Salary Component", "Professional Tax"):
|
||||
frappe.db.set_value(
|
||||
"Salary Component", "Professional Tax", "component_type", "Professional Tax"
|
||||
)
|
@ -1,44 +0,0 @@
|
||||
# Copyright (c) 2019, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
from erpnext.setup.install import add_non_standard_user_types
|
||||
|
||||
|
||||
def execute():
|
||||
doctype_dict = {
|
||||
"projects": ["Timesheet"],
|
||||
"payroll": [
|
||||
"Salary Slip",
|
||||
"Employee Tax Exemption Declaration",
|
||||
"Employee Tax Exemption Proof Submission",
|
||||
"Employee Benefit Application",
|
||||
"Employee Benefit Claim",
|
||||
],
|
||||
"hr": [
|
||||
"Employee",
|
||||
"Expense Claim",
|
||||
"Leave Application",
|
||||
"Attendance Request",
|
||||
"Compensatory Leave Request",
|
||||
"Holiday List",
|
||||
"Employee Advance",
|
||||
"Training Program",
|
||||
"Training Feedback",
|
||||
"Shift Request",
|
||||
"Employee Grievance",
|
||||
"Employee Referral",
|
||||
"Travel Request",
|
||||
],
|
||||
}
|
||||
|
||||
for module, doctypes in doctype_dict.items():
|
||||
for doctype in doctypes:
|
||||
frappe.reload_doc(module, "doctype", doctype)
|
||||
|
||||
frappe.flags.ignore_select_perm = True
|
||||
frappe.flags.update_select_perm_after_migrate = True
|
||||
|
||||
add_non_standard_user_types()
|
@ -1,52 +0,0 @@
|
||||
# Copyright (c) 2019, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
frappe.db.sql(
|
||||
"""UPDATE `tabPrint Format`
|
||||
SET module = 'Payroll'
|
||||
WHERE name IN ('Salary Slip Based On Timesheet', 'Salary Slip Standard')"""
|
||||
)
|
||||
|
||||
frappe.db.sql("""UPDATE `tabNotification` SET module='Payroll' WHERE name='Retention Bonus';""")
|
||||
|
||||
doctypes_moved = [
|
||||
"Employee Benefit Application Detail",
|
||||
"Employee Tax Exemption Declaration Category",
|
||||
"Salary Component",
|
||||
"Employee Tax Exemption Proof Submission Detail",
|
||||
"Income Tax Slab Other Charges",
|
||||
"Taxable Salary Slab",
|
||||
"Payroll Period Date",
|
||||
"Salary Slip Timesheet",
|
||||
"Payroll Employee Detail",
|
||||
"Salary Detail",
|
||||
"Employee Tax Exemption Sub Category",
|
||||
"Employee Tax Exemption Category",
|
||||
"Employee Benefit Claim",
|
||||
"Employee Benefit Application",
|
||||
"Employee Other Income",
|
||||
"Employee Tax Exemption Proof Submission",
|
||||
"Employee Tax Exemption Declaration",
|
||||
"Employee Incentive",
|
||||
"Retention Bonus",
|
||||
"Additional Salary",
|
||||
"Income Tax Slab",
|
||||
"Payroll Period",
|
||||
"Salary Slip",
|
||||
"Payroll Entry",
|
||||
"Salary Structure Assignment",
|
||||
"Salary Structure",
|
||||
]
|
||||
|
||||
for doctype in doctypes_moved:
|
||||
frappe.delete_doc_if_exists("DocType", doctype)
|
||||
|
||||
reports = ["Salary Register", "Bank Remittance"]
|
||||
|
||||
for report in reports:
|
||||
frappe.delete_doc_if_exists("Report", report)
|
@ -1,30 +0,0 @@
|
||||
# Copyright (c) 2019, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
data = frappe.db.sql(
|
||||
"""SELECT *
|
||||
FROM `tabSingles`
|
||||
WHERE
|
||||
doctype = "HR Settings"
|
||||
AND
|
||||
field in (
|
||||
"encrypt_salary_slips_in_emails",
|
||||
"email_salary_slip_to_employee",
|
||||
"daily_wages_fraction_for_half_day",
|
||||
"disable_rounded_total",
|
||||
"include_holidays_in_total_working_days",
|
||||
"max_working_hours_against_timesheet",
|
||||
"payroll_based_on",
|
||||
"password_policy"
|
||||
)
|
||||
""",
|
||||
as_dict=1,
|
||||
)
|
||||
|
||||
for d in data:
|
||||
frappe.db.set_value("Payroll Settings", None, d.field, d.value)
|
@ -1,135 +0,0 @@
|
||||
# Copyright (c) 2019, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
if not (
|
||||
frappe.db.table_exists("Payroll Period") and frappe.db.table_exists("Taxable Salary Slab")
|
||||
):
|
||||
return
|
||||
|
||||
for doctype in (
|
||||
"income_tax_slab",
|
||||
"salary_structure_assignment",
|
||||
"employee_other_income",
|
||||
"income_tax_slab_other_charges",
|
||||
):
|
||||
frappe.reload_doc("Payroll", "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
|
||||
{0}
|
||||
FROM
|
||||
`tabPayroll Period`
|
||||
WHERE company=%s
|
||||
ORDER BY start_date DESC
|
||||
""".format(
|
||||
select_fields
|
||||
),
|
||||
company.name,
|
||||
as_dict=1,
|
||||
)
|
||||
|
||||
for i, period in enumerate(payroll_periods):
|
||||
income_tax_slab = frappe.new_doc("Income Tax Slab")
|
||||
income_tax_slab.name = "Tax Slab:" + period.name
|
||||
|
||||
if i == 0:
|
||||
income_tax_slab.disabled = 0
|
||||
else:
|
||||
income_tax_slab.disabled = 1
|
||||
|
||||
income_tax_slab.effective_from = period.start_date
|
||||
income_tax_slab.company = company.name
|
||||
income_tax_slab.allow_tax_exemption = 1
|
||||
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()
|
||||
|
||||
frappe.db.sql(
|
||||
""" UPDATE `tabTaxable Salary Slab`
|
||||
SET parent = %s , parentfield = 'slabs' , parenttype = "Income Tax Slab"
|
||||
WHERE parent = %s
|
||||
""",
|
||||
(income_tax_slab.name, period.name),
|
||||
as_dict=1,
|
||||
)
|
||||
|
||||
if i == 0:
|
||||
frappe.db.sql(
|
||||
"""
|
||||
UPDATE
|
||||
`tabSalary Structure Assignment`
|
||||
set
|
||||
income_tax_slab = %s
|
||||
where
|
||||
company = %s
|
||||
and from_date >= %s
|
||||
and docstatus < 2
|
||||
""",
|
||||
(income_tax_slab.name, company.name, period.start_date),
|
||||
)
|
||||
|
||||
# move other incomes to separate document
|
||||
if not frappe.db.table_exists("Employee Tax Exemption Proof Submission"):
|
||||
return
|
||||
|
||||
migrated = []
|
||||
proofs = frappe.get_all(
|
||||
"Employee Tax Exemption Proof Submission",
|
||||
filters={"docstatus": 1},
|
||||
fields=["payroll_period", "employee", "company", "income_from_other_sources"],
|
||||
)
|
||||
for proof in proofs:
|
||||
if proof.income_from_other_sources:
|
||||
employee_other_income = frappe.new_doc("Employee Other Income")
|
||||
employee_other_income.employee = proof.employee
|
||||
employee_other_income.payroll_period = proof.payroll_period
|
||||
employee_other_income.company = proof.company
|
||||
employee_other_income.amount = proof.income_from_other_sources
|
||||
|
||||
try:
|
||||
employee_other_income.submit()
|
||||
migrated.append([proof.employee, proof.payroll_period])
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if not frappe.db.table_exists("Employee Tax Exemption Declaration"):
|
||||
return
|
||||
|
||||
declerations = frappe.get_all(
|
||||
"Employee Tax Exemption Declaration",
|
||||
filters={"docstatus": 1},
|
||||
fields=["payroll_period", "employee", "company", "income_from_other_sources"],
|
||||
)
|
||||
|
||||
for declaration in declerations:
|
||||
if (
|
||||
declaration.income_from_other_sources
|
||||
and [declaration.employee, declaration.payroll_period] not in migrated
|
||||
):
|
||||
employee_other_income = frappe.new_doc("Employee Other Income")
|
||||
employee_other_income.employee = declaration.employee
|
||||
employee_other_income.payroll_period = declaration.payroll_period
|
||||
employee_other_income.company = declaration.company
|
||||
employee_other_income.amount = declaration.income_from_other_sources
|
||||
|
||||
try:
|
||||
employee_other_income.submit()
|
||||
except Exception:
|
||||
pass
|
@ -1,21 +0,0 @@
|
||||
import frappe
|
||||
from frappe.model.utils.rename_field import rename_field
|
||||
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("hr", "doctype", "hr_settings")
|
||||
|
||||
try:
|
||||
# Rename the field
|
||||
rename_field("HR Settings", "stop_birthday_reminders", "send_birthday_reminders")
|
||||
|
||||
# Reverse the value
|
||||
old_value = frappe.db.get_single_value("HR Settings", "send_birthday_reminders")
|
||||
|
||||
frappe.db.set_value(
|
||||
"HR Settings", "HR Settings", "send_birthday_reminders", 1 if old_value == 0 else 0
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
if e.args[0] != 1054:
|
||||
raise
|
@ -1,12 +0,0 @@
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("HR", "doctype", "Leave Allocation")
|
||||
frappe.reload_doc("HR", "doctype", "Leave Ledger Entry")
|
||||
frappe.db.sql(
|
||||
"""update `tabLeave Ledger Entry` as lle set company = (select company from `tabEmployee` where employee = lle.employee)"""
|
||||
)
|
||||
frappe.db.sql(
|
||||
"""update `tabLeave Allocation` as la set company = (select company from `tabEmployee` where employee = la.employee)"""
|
||||
)
|
@ -1,16 +0,0 @@
|
||||
import frappe
|
||||
from frappe.query_builder import Case
|
||||
|
||||
|
||||
def execute():
|
||||
PayrollEntry = frappe.qb.DocType("Payroll Entry")
|
||||
|
||||
(
|
||||
frappe.qb.update(PayrollEntry).set(
|
||||
"status",
|
||||
Case()
|
||||
.when(PayrollEntry.docstatus == 0, "Draft")
|
||||
.when(PayrollEntry.docstatus == 1, "Submitted")
|
||||
.else_("Cancelled"),
|
||||
)
|
||||
).run()
|
@ -1,11 +0,0 @@
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("hr", "doctype", "training_event")
|
||||
frappe.reload_doc("hr", "doctype", "training_event_employee")
|
||||
|
||||
frappe.db.sql("update `tabTraining Event Employee` set `attendance` = 'Present'")
|
||||
frappe.db.sql(
|
||||
"update `tabTraining Event Employee` set `is_mandatory` = 1 where `attendance` = 'Mandatory'"
|
||||
)
|
@ -1,29 +0,0 @@
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("hr", "doctype", "employee_advance")
|
||||
|
||||
advance = frappe.qb.DocType("Employee Advance")
|
||||
(
|
||||
frappe.qb.update(advance)
|
||||
.set(advance.status, "Returned")
|
||||
.where(
|
||||
(advance.docstatus == 1)
|
||||
& ((advance.return_amount) & (advance.paid_amount == advance.return_amount))
|
||||
& (advance.status == "Paid")
|
||||
)
|
||||
).run()
|
||||
|
||||
(
|
||||
frappe.qb.update(advance)
|
||||
.set(advance.status, "Partly Claimed and Returned")
|
||||
.where(
|
||||
(advance.docstatus == 1)
|
||||
& (
|
||||
(advance.claimed_amount & advance.return_amount)
|
||||
& (advance.paid_amount == (advance.return_amount + advance.claimed_amount))
|
||||
)
|
||||
& (advance.status == "Paid")
|
||||
)
|
||||
).run()
|
@ -1,25 +0,0 @@
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
"""
|
||||
Update Expense Claim status to Paid if:
|
||||
- the entire required amount is already covered via linked advances
|
||||
- the claim is partially paid via advances and the rest is reimbursed
|
||||
"""
|
||||
|
||||
ExpenseClaim = frappe.qb.DocType("Expense Claim")
|
||||
|
||||
(
|
||||
frappe.qb.update(ExpenseClaim)
|
||||
.set(ExpenseClaim.status, "Paid")
|
||||
.where(
|
||||
(
|
||||
(ExpenseClaim.grand_total == 0)
|
||||
| (ExpenseClaim.grand_total == ExpenseClaim.total_amount_reimbursed)
|
||||
)
|
||||
& (ExpenseClaim.approval_status == "Approved")
|
||||
& (ExpenseClaim.docstatus == 1)
|
||||
& (ExpenseClaim.total_sanctioned_amount > 0)
|
||||
)
|
||||
).run()
|
@ -6,7 +6,7 @@ import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("hr", "doctype", "employee")
|
||||
frappe.reload_doc("setup", "doctype", "employee")
|
||||
|
||||
if frappe.db.has_column("Employee", "reason_for_resignation"):
|
||||
frappe.db.sql(
|
||||
|
@ -1,15 +0,0 @@
|
||||
# Copyright (c) 2019, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("hr", "doctype", "shift_assignment")
|
||||
if frappe.db.has_column("Shift Assignment", "date"):
|
||||
frappe.db.sql(
|
||||
"""update `tabShift Assignment`
|
||||
set end_date=date, start_date=date
|
||||
where date IS NOT NULL and start_date IS NULL and end_date IS NULL;"""
|
||||
)
|
@ -1,133 +0,0 @@
|
||||
# Copyright (c) 2019, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.model.utils.rename_field import rename_field
|
||||
|
||||
|
||||
def execute():
|
||||
|
||||
frappe.reload_doc("Accounts", "doctype", "Salary Component Account")
|
||||
if frappe.db.has_column("Salary Component Account", "default_account"):
|
||||
rename_field("Salary Component Account", "default_account", "account")
|
||||
|
||||
doctype_list = [
|
||||
{"module": "HR", "doctype": "Employee Advance"},
|
||||
{"module": "HR", "doctype": "Leave Encashment"},
|
||||
{"module": "Payroll", "doctype": "Additional Salary"},
|
||||
{"module": "Payroll", "doctype": "Employee Benefit Application"},
|
||||
{"module": "Payroll", "doctype": "Employee Benefit Claim"},
|
||||
{"module": "Payroll", "doctype": "Employee Incentive"},
|
||||
{"module": "Payroll", "doctype": "Employee Tax Exemption Declaration"},
|
||||
{"module": "Payroll", "doctype": "Employee Tax Exemption Proof Submission"},
|
||||
{"module": "Payroll", "doctype": "Income Tax Slab"},
|
||||
{"module": "Payroll", "doctype": "Payroll Entry"},
|
||||
{"module": "Payroll", "doctype": "Retention Bonus"},
|
||||
{"module": "Payroll", "doctype": "Salary Structure"},
|
||||
{"module": "Payroll", "doctype": "Salary Structure Assignment"},
|
||||
{"module": "Payroll", "doctype": "Salary Slip"},
|
||||
]
|
||||
|
||||
for item in doctype_list:
|
||||
frappe.reload_doc(item["module"], "doctype", item["doctype"])
|
||||
|
||||
# update company in employee advance based on employee company
|
||||
for dt in [
|
||||
"Employee Incentive",
|
||||
"Leave Encashment",
|
||||
"Employee Benefit Application",
|
||||
"Employee Benefit Claim",
|
||||
]:
|
||||
frappe.db.sql(
|
||||
"""
|
||||
update `tab{doctype}`
|
||||
set company = (select company from tabEmployee where name=`tab{doctype}`.employee)
|
||||
""".format(
|
||||
doctype=dt
|
||||
)
|
||||
)
|
||||
|
||||
# update exchange rate for employee advance
|
||||
frappe.db.sql("update `tabEmployee Advance` set exchange_rate=1")
|
||||
|
||||
# get all companies and it's currency
|
||||
all_companies = frappe.db.get_all(
|
||||
"Company", fields=["name", "default_currency", "default_payroll_payable_account"]
|
||||
)
|
||||
for d in all_companies:
|
||||
company = d.name
|
||||
company_currency = d.default_currency
|
||||
default_payroll_payable_account = d.default_payroll_payable_account
|
||||
|
||||
if not default_payroll_payable_account:
|
||||
default_payroll_payable_account = frappe.db.get_value(
|
||||
"Account",
|
||||
{
|
||||
"account_name": _("Payroll Payable"),
|
||||
"company": company,
|
||||
"account_currency": company_currency,
|
||||
"is_group": 0,
|
||||
},
|
||||
)
|
||||
|
||||
# update currency in following doctypes based on company currency
|
||||
doctypes_for_currency = [
|
||||
"Employee Advance",
|
||||
"Leave Encashment",
|
||||
"Employee Benefit Application",
|
||||
"Employee Benefit Claim",
|
||||
"Employee Incentive",
|
||||
"Additional Salary",
|
||||
"Employee Tax Exemption Declaration",
|
||||
"Employee Tax Exemption Proof Submission",
|
||||
"Income Tax Slab",
|
||||
"Retention Bonus",
|
||||
"Salary Structure",
|
||||
]
|
||||
|
||||
for dt in doctypes_for_currency:
|
||||
frappe.db.sql(
|
||||
"""update `tab{doctype}` set currency = %s where company=%s""".format(doctype=dt),
|
||||
(company_currency, company),
|
||||
)
|
||||
|
||||
# update fields in payroll entry
|
||||
frappe.db.sql(
|
||||
"""
|
||||
update `tabPayroll Entry`
|
||||
set currency = %s,
|
||||
exchange_rate = 1,
|
||||
payroll_payable_account=%s
|
||||
where company=%s
|
||||
""",
|
||||
(company_currency, default_payroll_payable_account, company),
|
||||
)
|
||||
|
||||
# update fields in Salary Structure Assignment
|
||||
frappe.db.sql(
|
||||
"""
|
||||
update `tabSalary Structure Assignment`
|
||||
set currency = %s,
|
||||
payroll_payable_account=%s
|
||||
where company=%s
|
||||
""",
|
||||
(company_currency, default_payroll_payable_account, company),
|
||||
)
|
||||
|
||||
# update fields in Salary Slip
|
||||
frappe.db.sql(
|
||||
"""
|
||||
update `tabSalary Slip`
|
||||
set currency = %s,
|
||||
exchange_rate = 1,
|
||||
base_hour_rate = hour_rate,
|
||||
base_gross_pay = gross_pay,
|
||||
base_total_deduction = total_deduction,
|
||||
base_net_pay = net_pay,
|
||||
base_rounded_total = rounded_total,
|
||||
base_total_in_words = total_in_words
|
||||
where company=%s
|
||||
""",
|
||||
(company_currency, company),
|
||||
)
|
@ -1,29 +0,0 @@
|
||||
import os
|
||||
|
||||
import frappe
|
||||
from frappe import _
|
||||
|
||||
|
||||
def execute():
|
||||
template = frappe.db.exists("Email Template", _("Exit Questionnaire Notification"))
|
||||
if not template:
|
||||
base_path = frappe.get_app_path("erpnext", "hr", "doctype")
|
||||
response = frappe.read_file(
|
||||
os.path.join(base_path, "exit_interview/exit_questionnaire_notification_template.html")
|
||||
)
|
||||
|
||||
template = frappe.get_doc(
|
||||
{
|
||||
"doctype": "Email Template",
|
||||
"name": _("Exit Questionnaire Notification"),
|
||||
"response": response,
|
||||
"subject": _("Exit Questionnaire Notification"),
|
||||
"owner": frappe.session.user,
|
||||
}
|
||||
).insert(ignore_permissions=True)
|
||||
template = template.name
|
||||
|
||||
hr_settings = frappe.get_doc("HR Settings")
|
||||
hr_settings.exit_questionnaire_notification_template = template
|
||||
hr_settings.flags.ignore_links = True
|
||||
hr_settings.save()
|
@ -1,5 +0,0 @@
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
frappe.delete_doc("DocType", "Employee Transfer Property", ignore_missing=True)
|
@ -1,29 +0,0 @@
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("payroll", "doctype", "employee_cost_center")
|
||||
frappe.reload_doc("payroll", "doctype", "salary_structure_assignment")
|
||||
|
||||
employees = frappe.get_all("Employee", fields=["department", "payroll_cost_center", "name"])
|
||||
|
||||
employee_cost_center = {}
|
||||
for d in employees:
|
||||
cost_center = d.payroll_cost_center
|
||||
if not cost_center and d.department:
|
||||
cost_center = frappe.get_cached_value("Department", d.department, "payroll_cost_center")
|
||||
|
||||
if cost_center:
|
||||
employee_cost_center.setdefault(d.name, cost_center)
|
||||
|
||||
salary_structure_assignments = frappe.get_all(
|
||||
"Salary Structure Assignment", filters={"docstatus": ["!=", 2]}, fields=["name", "employee"]
|
||||
)
|
||||
|
||||
for d in salary_structure_assignments:
|
||||
cost_center = employee_cost_center.get(d.employee)
|
||||
if cost_center:
|
||||
assignment = frappe.get_doc("Salary Structure Assignment", d.name)
|
||||
if not assignment.get("payroll_cost_centers"):
|
||||
assignment.append("payroll_cost_centers", {"cost_center": cost_center, "percentage": 100})
|
||||
assignment.save()
|
@ -1,19 +0,0 @@
|
||||
import os
|
||||
|
||||
import frappe
|
||||
from frappe import _
|
||||
|
||||
|
||||
def execute():
|
||||
base_path = frappe.get_app_path("erpnext", "hr", "doctype")
|
||||
response = frappe.read_file(
|
||||
os.path.join(base_path, "leave_application/leave_application_email_template.html")
|
||||
)
|
||||
|
||||
template = frappe.db.exists("Email Template", _("Leave Approval Notification"))
|
||||
if template:
|
||||
frappe.db.set_value("Email Template", template, "response", response)
|
||||
|
||||
template = frappe.db.exists("Email Template", _("Leave Status Notification"))
|
||||
if template:
|
||||
frappe.db.set_value("Email Template", template, "response", response)
|
@ -8,12 +8,6 @@ def execute():
|
||||
if not company:
|
||||
return
|
||||
|
||||
frappe.reload_doc("Payroll", "doctype", "payroll_period")
|
||||
frappe.reload_doc("Payroll", "doctype", "employee_tax_exemption_declaration")
|
||||
frappe.reload_doc("Payroll", "doctype", "employee_tax_exemption_proof_submission")
|
||||
frappe.reload_doc("Payroll", "doctype", "employee_tax_exemption_declaration_category")
|
||||
frappe.reload_doc("Payroll", "doctype", "employee_tax_exemption_proof_submission_detail")
|
||||
|
||||
frappe.reload_doc("accounts", "doctype", "tax_category")
|
||||
|
||||
for doctype in ["Sales Invoice", "Delivery Note", "Purchase Invoice"]:
|
||||
|
Loading…
x
Reference in New Issue
Block a user