Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions addons/hr_recruitment/migrations/9.0.1.0/noupdate_changes.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version='1.0' encoding='utf-8'?>
<openerp>

@susport susport Dec 6, 2016

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove labels openerp data by odoo in v9.0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an automatic file generated by https://github.com/OCA/OpenUpgrade/blob/9.0/scripts/compare_noupdate_xml_records.py, so we can leave it as is for this version and change the script for next one.

<data>
<record id="mt_job_applicant_stage_changed" model="mail.message.subtype"><field name="default" eval="False"/>
</record>
<record id="base.open_menu" model="ir.actions.todo"><field name="action_id" ref="action_client_hr_recruitment_menu"/>
</record>
<record id="mt_applicant_hired" model="mail.message.subtype"><field name="default" eval="True"/>
</record>
<record id="mt_applicant_new" model="mail.message.subtype"><field name="hidden" eval="True"/>
</record>
<record id="module_install_notification" model="mail.message"><field name="type"/><field name="model">mail.channel</field>
<field name="res_id" ref="mail.channel_all_employees"/>
<field name="message_type">notification</field>
</record>
</data>
</openerp>

113 changes: 113 additions & 0 deletions addons/hr_recruitment/migrations/9.0.1.0/openupgrade_analysis_work.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
---Fields in module 'hr_recruitment'---
hr_recruitment / hr.applicant / attachment_ids (one2many) : NEW relation: ir.attachment
# Nothing to do

hr_recruitment / hr.applicant / availability (integer) : type is now 'date' ('integer')
# Done: calculated availability with create_date + availability days

hr_recruitment / hr.applicant / campaign_id (many2one) : NEW relation: utm.campaign
# Nothing to do

hr_recruitment / hr.applicant / categ_ids (many2many) : relation is now 'hr.applicant.category' ('hr.applicant_category')
# Nothing to do

hr_recruitment / hr.applicant / medium_id (many2one) : NEW relation: utm.medium
# Nothing to do

hr_recruitment / hr.applicant / message_follower_ids (many2many): not a function anymore
hr_recruitment / hr.applicant / message_follower_ids (many2many): relation is now 'mail.followers' ('res.partner')
hr_recruitment / hr.applicant / message_follower_ids (many2many): type is now 'one2many' ('many2many')
# Concerns module Mail (has to be done in another migration script specifically for that module) ---> Nothing to do

hr_recruitment / hr.applicant / priority (selection) : selection_keys is now '['0', '1', '2', '3']' ('['0', '1', '2', '3', '4']')
# Done: Adapt to new range

hr_recruitment / hr.applicant / source_id (many2one) : relation is now 'utm.source' ('hr.recruitment.source')
# Done: created new utm.source from source_id and updated records

hr_recruitment / hr.applicant.category / name (char) : NEW required: required
# Nothing to do

hr_recruitment / hr.job / stage_ids (many2many) : NEW relation: hr.recruitment.stage
# Nothing to do

hr_recruitment / hr.recruitment.source / _inherits (False) : NEW
# Nothing to do

hr_recruitment / hr.recruitment.source / alias_id (many2one) : NEW relation: mail.alias
# Nothing to do

hr_recruitment / hr.recruitment.source / job_id (many2one) : NEW relation: hr.job
# Nothing to do

hr_recruitment / hr.recruitment.source / name (char) : DEL required: required
hr_recruitment / hr.recruitment.source / source_id (many2one) : NEW relation: utm.source, required: required
# Nothing to do

hr_recruitment / hr.recruitment.stage / department_id (many2one) : DEL relation: hr.department
hr_recruitment / hr.recruitment.stage / job_ids (many2many) : NEW relation: hr.job
# Nothing to do

hr_recruitment / hr.recruitment.stage / template_id (many2one) : relation is now 'mail.template' ('email.template')
# Nothing to do


---XML records in module 'hr_recruitment'---
DEL email.template: hr_recruitment.applicant_interest
DEL email.template: hr_recruitment.applicant_refuse
NEW hr.applicant.category: hr_recruitment.tag_applicant_it
NEW hr.applicant.category: hr_recruitment.tag_applicant_manager
NEW hr.applicant.category: hr_recruitment.tag_applicant_reserve
NEW hr.applicant.category: hr_recruitment.tag_applicant_sales
DEL hr.applicant_category: hr_recruitment.tag_applicant_it
DEL hr.applicant_category: hr_recruitment.tag_applicant_manager
DEL hr.applicant_category: hr_recruitment.tag_applicant_reserve
DEL hr.applicant_category: hr_recruitment.tag_applicant_sales
DEL hr.recruitment.source: hr_recruitment.source_linkedin
DEL hr.recruitment.source: hr_recruitment.source_monster
DEL hr.recruitment.source: hr_recruitment.source_website_company
DEL hr.recruitment.source: hr_recruitment.source_word
DEL hr.recruitment.stage: hr_recruitment.stage_job1
DEL hr.recruitment.stage: hr_recruitment.stage_job2
DEL hr.recruitment.stage: hr_recruitment.stage_job3
DEL hr.recruitment.stage: hr_recruitment.stage_job4
DEL hr.recruitment.stage: hr_recruitment.stage_job5
DEL hr.recruitment.stage: hr_recruitment.stage_job6
NEW ir.actions.act_window: hr_recruitment.action_hr_job_config
NEW ir.actions.act_window: hr_recruitment.action_hr_job_new_application
NEW ir.actions.act_window: hr_recruitment.action_hr_job_no_employee
NEW ir.actions.act_window: hr_recruitment.action_hr_job_sources
NEW ir.actions.act_window: hr_recruitment.action_hr_recruitment_configuration
NEW ir.actions.act_window: hr_recruitment.action_hr_recruitment_report_filtered_department
NEW ir.actions.act_window: hr_recruitment.action_hr_recruitment_report_filtered_job
NEW ir.actions.act_window: hr_recruitment.hr_applicant_action_from_department
NEW ir.actions.act_window: hr_recruitment.hr_applicant_resumes
NEW ir.actions.act_window: hr_recruitment.hr_employee_action_from_department
DEL ir.actions.act_window: hr_recruitment.act_hr_applicant_to_meeting
DEL ir.actions.act_window: hr_recruitment.action_hr_recruitment_partner_create
DEL ir.actions.act_window: hr_recruitment.hr_recruitment_stage_form_installer
NEW ir.actions.client: hr_recruitment.action_client_hr_recruitment_menu
NEW ir.ui.menu: hr.menu_hr_job_position_config
NEW ir.ui.menu: hr_recruitment.menu_crm_case_categ0_act_job02
NEW ir.ui.menu: hr_recruitment.menu_hr_recruitment_configuration
NEW ir.ui.menu: hr_recruitment.menu_hr_recruitment_global_settings
NEW ir.ui.menu: hr_recruitment.menu_hr_recruitment_root
NEW ir.ui.menu: hr_recruitment.report_hr_recruitment
DEL ir.ui.menu: base.menu_crm_case_job_req_main
DEL ir.ui.menu: hr_recruitment.menu_hr_recruitment_recruitment
DEL ir.ui.menu: hr_recruitment.menu_hr_recruitment_report_all
NEW ir.ui.view: hr_recruitment.crm_case_pivot_view_job
NEW ir.ui.view: hr_recruitment.hr_department_view_kanban
NEW ir.ui.view: hr_recruitment.hr_employee_view_search
NEW ir.ui.view: hr_recruitment.view_hr_recruitment_configuration
NEW ir.ui.view: hr_recruitment.view_hr_recruitment_report_pivot
DEL ir.ui.view: hr_recruitment.hr_recruitment_source_form
DEL ir.ui.view: hr_recruitment.view_hr_apll_config_settings
DEL ir.ui.view: hr_recruitment.view_hr_recruitment_partner_create
NEW mail.message.subtype: hr_recruitment.mt_department_new
NEW mail.message.subtype: hr_recruitment.mt_job_new
DEL mail.message.subtype: hr_recruitment.mt_job_applicant_new
NEW mail.template: hr_recruitment.applicant_interest
NEW mail.template: hr_recruitment.applicant_refuse
NEW mail.template: hr_recruitment.hr_welcome_new_employee
NEW utm.campaign: hr_recruitment.utm_campaign_job
59 changes: 59 additions & 0 deletions addons/hr_recruitment/migrations/9.0.1.0/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# -*- coding: utf-8 -*-
# © 2016 Tecnativa <vicent.cubells@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openupgradelib import openupgrade
from openerp import fields
from datetime import timedelta


def update_applicant_availability(cr):
cr.execute(
"""
SELECT id, create_date, %s
FROM hr_applicant
""" % (openupgrade.get_legacy_name('availability'),)
)
for applicant in cr.fetchall():
new_date = fields.Date.from_string(applicant[1])
if applicant[2]:
new_date += timedelta(days=int(applicant[2]))
new_date = fields.Date.to_string(new_date)
openupgrade.logged_query(
cr,
"""
UPDATE hr_applicant SET availability = %s
WHERE id = %s
""", (new_date, applicant[0]))


def migrate_applicant_source(cr):
cr.execute(
"""
SELECT id
FROM hr_recruitment_source
""")
for old_id in cr.fetchall():
cr.execute("INSERT INTO utm_source (name) "
"SELECT name "
"FROM %s "
"RETURNING id",
(openupgrade.get_legacy_name('hr_recruitment_source'),))
new_id = cr.fetchone()[0]
cr.execute("UPDATE hr_applicant "
"SET source_id = %s "
"WHERE source_id = %s",
(new_id, old_id[0]))


@openupgrade.migrate()
def migrate(cr, version):
openupgrade.load_data(cr, 'hr_recruitment',
'migrations/9.0.1.0/noupdate_changes.xml')
openupgrade.map_values(
cr,
openupgrade.get_legacy_name('priority'),
'priority',
[('1', '0'), ('2', '0'), ('3', '1'), ('4', '3')],
table='hr_applicant', write='sql')
update_applicant_availability(cr)
migrate_applicant_source(cr)
21 changes: 21 additions & 0 deletions addons/hr_recruitment/migrations/9.0.1.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# © 2016 Tecnativa - Vicent Cubells <vicent.cubells@tecnativa.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from openupgradelib import openupgrade


column_renames = {
'hr_applicant': [
('priority', None),
('availability', None),
]}

table_renames = [
('hr_recruitment_source', None),
]


@openupgrade.migrate()
def migrate(cr, version):
openupgrade.rename_columns(cr, column_renames)
openupgrade.rename_tables(cr, table_renames)
2 changes: 1 addition & 1 deletion openerp/openupgrade/doc/source/modules80-90.rst
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Status :
+-----------------------------------+-----------------------------------+
|hr_payroll_account | Done |
+-----------------------------------+-----------------------------------+
|hr_recruitment | |
|hr_recruitment | Done |
+-----------------------------------+-----------------------------------+
|hr_timesheet | Done |
+-----------------------------------+-----------------------------------+
Expand Down