Skip to content

Commit b2bb2d8

Browse files
authored
Merge pull request #2388 from ForgeFlow/13.0-mig-sale_timesheet-script
[13.0][MIG] sale_timesheet
2 parents ebb024f + cc20632 commit b2bb2d8

File tree

4 files changed

+90
-1
lines changed

4 files changed

+90
-1
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---Models in module 'sale_timesheet'---
2+
obsolete model project.task.assign.sale [transient]
3+
# NOTHING TO DO
4+
5+
---Fields in module 'sale_timesheet'---
6+
sale_timesheet / account.analytic.line / timesheet_invoice_id (many2one): relation is now 'account.move' ('account.invoice') [nothing to do]
7+
sale_timesheet / account.invoice / timesheet_ids (one2many) : DEL relation: account.analytic.line
8+
sale_timesheet / account.move / timesheet_ids (one2many) : NEW relation: account.analytic.line
9+
# DONE: pre-migration: renamed column for avoiding FK constraint
10+
# DONE: post-migration: mapped invoice to moves
11+
12+
sale_timesheet / product.template / service_tracking (selection) : selection_keys is now '['no', 'project_only', 'task_global_project', 'task_in_project']' ('['no', 'project_only', 'task_global_project', 'task_new_project']')
13+
# DONE: pre-migration: copied column for preserving old values
14+
# DONE: post-migration: change 'task_new_project' by 'task_in_project'
15+
16+
sale_timesheet / sale.order / project_id (many2one) : NEW relation: project.project
17+
# NOTHING TO DO: new feature for improving 'task_in_project' to handle more use cases
18+
19+
---XML records in module 'sale_timesheet'---
20+
NEW ir.actions.act_window: sale_timesheet.product_template_action_default_services
21+
NEW ir.actions.act_window: sale_timesheet.project_timesheet_action_client_timesheet_plan
22+
NEW ir.actions.act_window: sale_timesheet.timesheet_action_from_sales_order
23+
DEL ir.actions.act_window: sale_timesheet.product_template_action_fixed
24+
DEL ir.actions.act_window: sale_timesheet.product_template_action_milestone
25+
DEL ir.actions.act_window: sale_timesheet.product_template_action_time_based
26+
DEL ir.actions.act_window: sale_timesheet.project_task_action_multi_assign_so_line
27+
NEW ir.actions.act_window.view: sale_timesheet.timesheet_action_from_sales_order_form
28+
NEW ir.actions.act_window.view: sale_timesheet.timesheet_action_from_sales_order_tree
29+
DEL ir.actions.client: sale_timesheet.project_timesheet_action_client_timesheet_plan
30+
NEW ir.ui.view: sale_timesheet.assets_frontend
31+
NEW ir.ui.view: sale_timesheet.portal_invoice_page_inherit_timesheet
32+
NEW ir.ui.view: sale_timesheet.progressbar
33+
DEL ir.ui.view: sale_timesheet.project_project_view_search
34+
DEL ir.ui.view: sale_timesheet.project_task_assign_so_line_view_form
35+
DEL ir.ui.view: sale_timesheet.qunit_suite
36+
# NOTHING TO DO
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3+
from openupgradelib import openupgrade
4+
5+
6+
def map_invoices_to_moves(env):
7+
openupgrade.logged_query(
8+
env.cr, """
9+
UPDATE account_analytic_line aal
10+
SET timesheet_invoice_id = am.id
11+
FROM account_move am
12+
WHERE aal.{} = am.old_invoice_id
13+
""".format(openupgrade.get_legacy_name('timesheet_invoice_id')),
14+
)
15+
16+
17+
def map_mail_notification_type(env):
18+
openupgrade.map_values(
19+
env.cr,
20+
openupgrade.get_legacy_name('service_tracking'),
21+
'service_tracking',
22+
[('task_new_project', 'task_in_project'),
23+
],
24+
table='product_template',
25+
)
26+
27+
28+
@openupgrade.migrate()
29+
def migrate(env, version):
30+
map_invoices_to_moves(env)
31+
map_mail_notification_type(env)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
2+
# Copyright 2020 Tecnativa - Pedro M. Baeza
3+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
4+
from openupgradelib import openupgrade
5+
6+
_column_copies = {
7+
'product_template': [
8+
('service_tracking', None, None),
9+
],
10+
}
11+
_column_renames = {
12+
'account_analytic_line': [
13+
('timesheet_invoice_id', None),
14+
],
15+
}
16+
17+
18+
@openupgrade.migrate()
19+
def migrate(env, version):
20+
cr = env.cr
21+
openupgrade.copy_columns(cr, _column_copies)
22+
openupgrade.rename_columns(cr, _column_renames)

odoo/openupgrade/doc/source/modules120-130.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ missing in the new release are marked with |del|.
581581
+----------------------------------------------+-------------------------------------------------+
582582
|sale_stock | |
583583
+----------------------------------------------+-------------------------------------------------+
584-
|sale_timesheet | |
584+
|sale_timesheet | Done |
585585
+----------------------------------------------+-------------------------------------------------+
586586
| |new| sale_timesheet_purchase | |
587587
+----------------------------------------------+-------------------------------------------------+

0 commit comments

Comments
 (0)