-
-
Notifications
You must be signed in to change notification settings - Fork 785
[16.0][OU-ADD] sale_timesheet: Migration scripts #4020
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
hoangtiendung070797
wants to merge
1
commit into
OCA:16.0
from
hoangtiendung070797:v16_mig_sale_timesheet
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
openupgrade_scripts/scripts/sale_timesheet/16.0.1.0/pre-migration.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| from openupgradelib import openupgrade | ||
|
|
||
|
|
||
| def _update_account_analytic_line_timesheet_invoice_type(env): | ||
| openupgrade.logged_query( | ||
| env.cr, | ||
| """ | ||
| WITH timesheet_info as ( | ||
| SELECT aal.id as id, | ||
| product_tmpl.service_type as service_type | ||
| FROM account_analytic_line aal | ||
| JOIN sale_order_line sol | ||
| ON sol.id = aal.so_line | ||
| JOIN product_product product | ||
| ON product.id = sol.product_id | ||
| JOIN product_template product_tmpl | ||
| ON product_tmpl.id = product.product_tmpl_id | ||
| WHERE product_tmpl.type = 'service' | ||
| AND product_tmpl.invoice_policy = 'delivery' | ||
| AND product_tmpl.service_type IN ('milestones', 'manual') | ||
| ) | ||
| UPDATE account_analytic_line aal | ||
| SET timesheet_invoice_type = CONCAT('billable_', info.service_type) | ||
| FROM timesheet_info info | ||
| WHERE aal.id = info.id | ||
| """, | ||
| ) | ||
|
|
||
|
|
||
| @openupgrade.migrate() | ||
| def migrate(env, version): | ||
| _update_account_analytic_line_timesheet_invoice_type(env) | ||
62 changes: 62 additions & 0 deletions
62
openupgrade_scripts/scripts/sale_timesheet/16.0.1.0/upgrade_analysis_work.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| ---Models in module 'sale_timesheet'--- | ||
| obsolete model project.profitability.report [sql_view] | ||
| # NOTHING TO DO | ||
|
|
||
| ---Fields in module 'sale_timesheet'--- | ||
| sale_timesheet / account.analytic.line / timesheet_invoice_type (selection): selection_keys is now '['billable_fixed', 'billable_manual', 'billable_milestones', 'billable_time', 'non_billable', 'other_costs', 'other_revenues', 'service_revenues', 'timesheet_revenues']' ('['billable_fixed', 'billable_time', 'non_billable', 'other_costs', 'other_revenues', 'service_revenues', 'timesheet_revenues']') | ||
| # DONE: pre-migration: update the value for timesheet_invoice_type | ||
|
|
||
| sale_timesheet / product.product / service_policy (selection) : module is now 'sale_project' ('sale_timesheet') | ||
| sale_timesheet / product.template / service_policy (selection) : module is now 'sale_project' ('sale_timesheet') | ||
| # NOTHING TO DO: handle by ORM | ||
|
|
||
| sale_timesheet / product.template / service_policy (selection) : selection_keys is now 'function' ('['delivered_manual', 'delivered_timesheet', 'ordered_timesheet']') | ||
| # NOTHING TO DO: store="False" | ||
|
|
||
| sale_timesheet / product.template / service_type (False) : selection_keys is now '['manual', 'milestones', 'timesheet']' ('['manual', 'timesheet']') | ||
| # NOTHING TO DO: no keys to change | ||
|
|
||
| sale_timesheet / project.project / allocated_hours (False) : NEW mode: modify, hasdefault: compute | ||
| sale_timesheet / project.project / allow_billable (boolean) : module is now 'sale_project' ('sale_timesheet') | ||
| # NOTHING TO DO | ||
|
|
||
| sale_timesheet / sale.order.line / qty_delivered_method (False) : selection_keys is now '['analytic', 'manual', 'milestones', 'stock_move', 'timesheet']' ('['analytic', 'manual', 'stock_move', 'timesheet']') | ||
| # NOTHING TO DO: handle at module sale_project | ||
|
|
||
| sale_timesheet / sale.order.line / timesheet_ids (one2many) : NEW relation: account.analytic.line | ||
| # NOTHING TO Do | ||
|
|
||
| ---XML records in module 'sale_timesheet'--- | ||
| NEW ir.actions.act_window: sale_timesheet.timesheet_action_from_sales_order_item | ||
| NEW ir.actions.act_window.view: sale_timesheet.timesheet_action_from_sales_order_item_form | ||
| NEW ir.actions.act_window.view: sale_timesheet.timesheet_action_from_sales_order_item_graph | ||
| NEW ir.actions.act_window.view: sale_timesheet.timesheet_action_from_sales_order_item_kanban | ||
| NEW ir.actions.act_window.view: sale_timesheet.timesheet_action_from_sales_order_item_pivot | ||
| NEW ir.actions.act_window.view: sale_timesheet.timesheet_action_from_sales_order_item_tree | ||
| DEL ir.actions.act_window.view: sale_timesheet.timesheet_action_view_report_by_billing_rate_form | ||
| DEL ir.actions.act_window.view: sale_timesheet.timesheet_action_view_report_by_billing_rate_kanban | ||
| DEL ir.actions.act_window.view: sale_timesheet.timesheet_action_view_report_by_billing_rate_tree | ||
| NEW ir.actions.report: sale_timesheet.timesheet_report_account_move | ||
| NEW ir.actions.report: sale_timesheet.timesheet_report_sale_order | ||
| DEL ir.filters: sale_timesheet.ir_filter_project_profitability_report_costs_and_revenues | ||
| DEL ir.model.access: sale_timesheet.access_project_profitability_report_analysis_manager | ||
| NEW ir.ui.view: sale_timesheet.hr_timesheet_report_search_sale_timesheet | ||
| NEW ir.ui.view: sale_timesheet.project_project_view_kanban_inherit_sale_timesheet_so_button | ||
| NEW ir.ui.view: sale_timesheet.project_sharing_inherit_project_task_view_tree_sale_timesheet | ||
| NEW ir.ui.view: sale_timesheet.report_timesheet_account_move | ||
| NEW ir.ui.view: sale_timesheet.report_timesheet_sale_order | ||
| NEW ir.ui.view: sale_timesheet.timesheet_sale_page | ||
| NEW ir.ui.view: sale_timesheet.timesheets_analysis_report_graph_inherit | ||
| NEW ir.ui.view: sale_timesheet.timesheets_analysis_report_graph_invoice_type | ||
| NEW ir.ui.view: sale_timesheet.timesheets_analysis_report_pivot_inherit | ||
| NEW ir.ui.view: sale_timesheet.timesheets_analysis_report_pivot_invoice_type | ||
| NEW ir.ui.view: sale_timesheet.view_hr_timesheet_line_graph_employee_per_date | ||
| NEW ir.ui.view: sale_timesheet.view_task_tree2_inherited | ||
| DEL ir.ui.view: sale_timesheet.project_profitability_report_view_graph | ||
| DEL ir.ui.view: sale_timesheet.project_profitability_report_view_pivot | ||
| DEL ir.ui.view: sale_timesheet.project_profitability_report_view_search | ||
| DEL ir.ui.view: sale_timesheet.project_profitability_report_view_tree | ||
| DEL ir.ui.view: sale_timesheet.project_project_view_form_salesman | ||
| DEL ir.ui.view: sale_timesheet.project_task_view_form_inherit_sale_timesheet_editable | ||
| DEL ir.ui.view: sale_timesheet.timesheet_view_pivot_revenue | ||
| # NOTHING TO DO: noupdate="0" records |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @hoangtiendung070797
as per #4313 you may want to also drop view project_profitability_report :