forked from OCA/OpenUpgrade
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request OCA#10 from tranngocson1996/merged_from_upstream_1…
…4_220105_01 Merged from upstream 14 220105 01
- Loading branch information
Showing
7 changed files
with
242 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
36 changes: 36 additions & 0 deletions
36
openupgrade_scripts/scripts/account_edi/14.0.1.0/upgrade_analysis_work.txt
This file contains 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,36 @@ | ||
---Models in module 'account_edi'--- | ||
new model account.edi.document | ||
new model account.edi.format | ||
# NOTHING TO DO: new models | ||
|
||
---Fields in module 'account_edi'--- | ||
account_edi / account.edi.document / attachment_id (many2one) : NEW relation: ir.attachment | ||
account_edi / account.edi.document / edi_format_id (many2one) : NEW relation: account.edi.format, required | ||
account_edi / account.edi.document / error (html) : NEW | ||
account_edi / account.edi.document / move_id (many2one) : NEW relation: account.move, required | ||
account_edi / account.edi.document / state (selection) : NEW selection_keys: ['cancelled', 'sent', 'to_cancel', 'to_send'] | ||
account_edi / account.edi.format / code (char) : NEW required | ||
account_edi / account.edi.format / name (char) : NEW | ||
account_edi / account.journal / edi_format_ids (many2many) : NEW relation: account.edi.format, isfunction: function, stored | ||
# NOTHING TO DO | ||
|
||
account_edi / account.move / edi_document_ids (one2many) : NEW relation: account.edi.document | ||
account_edi / account.move / edi_state (selection) : NEW selection_keys: ['cancelled', 'sent', 'to_cancel', 'to_send'], isfunction: function, stored | ||
# NOTHING TO DO: created edi_state column and set the default value is false (in pre-migration on account module) | ||
|
||
---XML records in module 'account_edi'--- | ||
NEW ir.actions.act_window: account_edi.action_open_edi_documents | ||
NEW ir.actions.act_window: account_edi.action_open_payment_edi_documents | ||
NEW ir.cron: account_edi.ir_cron_edi_network | ||
NEW ir.model.access: account_edi.access_account_edi_document_group_invoice | ||
NEW ir.model.access: account_edi.access_account_edi_document_readonly | ||
NEW ir.model.access: account_edi.access_account_edi_format_group_invoice | ||
NEW ir.model.access: account_edi.access_account_edi_format_readonly | ||
NEW ir.model.constraint: account_edi.constraint_account_edi_document_unique_edi_document_by_move_by_format | ||
NEW ir.model.constraint: account_edi.constraint_account_edi_format_unique_code | ||
NEW ir.ui.view: account_edi.account_invoice_send_inherit_account_wizard_form | ||
NEW ir.ui.view: account_edi.view_account_journal_form_inherited | ||
NEW ir.ui.view: account_edi.view_move_form_inherit | ||
NEW ir.ui.view: account_edi.view_payment_form_inherit | ||
NEW ir.ui.view: account_edi.view_tree_account_edi_document | ||
# NOTHING TO DO |
45 changes: 45 additions & 0 deletions
45
openupgrade_scripts/scripts/sale_timesheet/14.0.1.0/post-migration.py
This file contains 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,45 @@ | ||
# Copyright (C) 2021 Open Source Integrators <https://www.opensourceintegrators.com/> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
from openupgradelib import openupgrade | ||
|
||
|
||
def fill_bill_type(env): | ||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
UPDATE project_project | ||
SET bill_type = 'customer_project' | ||
WHERE sale_order_id IS NOT NULL""", | ||
) | ||
|
||
|
||
def _fill_project_timesheet_product(env): | ||
"""Fill the proper timesheet product once it has been populated in the DB. | ||
It should be done before filling `allow_billable` for avoiding the constraint. | ||
""" | ||
product = env.ref("sale_timesheet.time_product") | ||
openupgrade.logged_query( | ||
env.cr, | ||
"""UPDATE project_project pp | ||
SET timesheet_product_id = %s | ||
WHERE pp.pricing_type IS NOT NULL AND pp.allow_timesheets""", | ||
(product.id,), | ||
) | ||
|
||
|
||
def fill_allow_billable(env): | ||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
UPDATE project_project | ||
SET allow_billable = TRUE | ||
WHERE pricing_type IS NOT NULL""", | ||
) | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
fill_bill_type(env) | ||
_fill_project_timesheet_product(env) | ||
fill_allow_billable(env) | ||
openupgrade.load_data(env.cr, "sale_timesheet", "14.0.1.0/noupdate_changes.xml") |
39 changes: 39 additions & 0 deletions
39
openupgrade_scripts/scripts/sale_timesheet/14.0.1.0/pre-migration.py
This file contains 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,39 @@ | ||
# Copyright (C) 2021 Open Source Integrators <https://www.opensourceintegrators.com/> | ||
# Copyright 2021 ForgeFlow S.L. <https://www.forgeflow.com> | ||
# Copyright 2021 Tecnativa - Pedro M. Baeza | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
from openupgradelib import openupgrade | ||
|
||
_column_copies = { | ||
"project_project": [("billable_type", None, None)], | ||
} | ||
_field_renames = [ | ||
("project.project", "project_project", "billable_type", "pricing_type"), | ||
] | ||
|
||
|
||
def map_pricing_type(env): | ||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
UPDATE project_project | ||
SET pricing_type = 'fixed_rate' | ||
WHERE pricing_type = 'task_rate'""", | ||
) | ||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
UPDATE project_project | ||
SET pricing_type = NULL | ||
WHERE pricing_type = 'no'""", | ||
) | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
openupgrade.copy_columns(env.cr, _column_copies) | ||
openupgrade.rename_fields(env, _field_renames) | ||
map_pricing_type(env) | ||
openupgrade.logged_query( | ||
env.cr, "ALTER TABLE project_project ADD timesheet_product_id int4" | ||
) |
96 changes: 96 additions & 0 deletions
96
openupgrade_scripts/scripts/sale_timesheet/14.0.1.0/upgrade_analysis_work.txt
This file contains 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,96 @@ | ||
---Models in module 'sale_timesheet'--- | ||
new model project.task.create.sale.order [transient] | ||
---Fields in module 'sale_timesheet'--- | ||
sale_timesheet / account.analytic.line / non_allow_billable (boolean) : NEW | ||
sale_timesheet / account.analytic.line / timesheet_invoice_type (selection): selection_keys is now '['billable_fixed', 'billable_time', 'non_billable', 'non_billable_project', 'non_billable_timesheet']' ('['billable_fixed', 'billable_time', 'non_billable', 'non_billable_project']') | ||
# NOTHING TO DO: new option/feature | ||
|
||
sale_timesheet / product.product / project_id (many2one) : module is now 'sale_project' ('sale_timesheet') | ||
sale_timesheet / product.product / project_template_id (many2one): module is now 'sale_project' ('sale_timesheet') | ||
sale_timesheet / product.product / service_tracking (selection) : module is now 'sale_project' ('sale_timesheet') | ||
sale_timesheet / product.template / project_id (many2one) : module is now 'sale_project' ('sale_timesheet') | ||
sale_timesheet / product.template / project_template_id (many2one): module is now 'sale_project' ('sale_timesheet') | ||
sale_timesheet / product.template / service_tracking (selection) : module is now 'sale_project' ('sale_timesheet') | ||
sale_timesheet / project.project / sale_line_id (many2one) : module is now 'sale_project' ('sale_timesheet') | ||
sale_timesheet / project.project / sale_order_id (many2one) : module is now 'sale_project' ('sale_timesheet') | ||
# NOTHING TO DO | ||
|
||
sale_timesheet / project.project / allow_billable (boolean) : NEW | ||
# DONE: post-migration: set TRUE if project has pricing_type | ||
|
||
sale_timesheet / project.project / bill_type (selection) : NEW selection_keys: ['customer_project', 'customer_task'], hasdefault | ||
# DONE: post-migration: set 'customer_project' if project has sale_order_id | ||
|
||
sale_timesheet / project.project / billable_type (selection) : DEL selection_keys: ['employee_rate', 'no', 'task_rate'] | ||
sale_timesheet / project.project / pricing_type (selection) : NEW selection_keys: ['employee_rate', 'fixed_rate'], hasdefault | ||
# DONE: pre-migration: Copied column for preserving values, rename field and remap some keys | ||
|
||
sale_timesheet / project.project / timesheet_product_id (many2one): NEW relation: product.product, hasdefault, isfunction: function, stored | ||
# DONE: pre-migration: Pre-create the column for avoiding the compute | ||
# DONE: post-migration: fill it with the default product that is already present | ||
|
||
sale_timesheet / project.sale.line.employee.map / currency_id (many2one) : NEW relation: res.currency, isfunction: function, stored | ||
sale_timesheet / project.sale.line.employee.map / price_unit (float) : is now stored | ||
sale_timesheet / project.sale.line.employee.map / price_unit (float) : not related anymore | ||
sale_timesheet / project.sale.line.employee.map / price_unit (float) : now a function | ||
# NOTHING TO DO: stored functions | ||
|
||
sale_timesheet / project.sale.line.employee.map / timesheet_product_id (many2one): NEW relation: product.product | ||
sale_timesheet / project.task / timesheet_product_id (many2one): NEW relation: product.product | ||
# NOTHING TO DO: new relations | ||
|
||
sale_timesheet / project.task / billable_type (selection) : DEL selection_keys: ['employee_rate', 'no', 'task_rate'] | ||
# NOTHING TO DO: deleted selection | ||
|
||
sale_timesheet / project.task / non_allow_billable (boolean) : NEW | ||
# NOTHING TO DO: new feature | ||
|
||
sale_timesheet / project.task / sale_line_id (many2one) : module is now 'sale_project' ('sale_timesheet') | ||
sale_timesheet / project.task / sale_line_id (many2one) : now a function | ||
sale_timesheet / project.task / sale_order_id (many2one) : module is now 'sale_project' ('sale_timesheet') | ||
sale_timesheet / project.task / sale_order_id (many2one) : not a function anymore | ||
# NOTHING TO DO | ||
|
||
sale_timesheet / sale.order / timesheet_total_duration (float): type is now 'integer' ('float') | ||
# NOTHING TO DO: this field is non-stored compute | ||
|
||
sale_timesheet / sale.order / project_id (many2one) : module is now 'sale_project' ('sale_timesheet') | ||
sale_timesheet / sale.order / project_ids (many2many) : module is now 'sale_project' ('sale_timesheet') | ||
sale_timesheet / sale.order / tasks_count (integer) : module is now 'sale_project' ('sale_timesheet') | ||
sale_timesheet / sale.order / tasks_ids (many2many) : module is now 'sale_project' ('sale_timesheet') | ||
sale_timesheet / sale.order / visible_project (boolean) : module is now 'sale_project' ('sale_timesheet') | ||
sale_timesheet / sale.order.line / is_service (boolean) : module is now 'sale_project' ('sale_timesheet') | ||
sale_timesheet / sale.order.line / project_id (many2one) : module is now 'sale_project' ('sale_timesheet') | ||
sale_timesheet / sale.order.line / task_id (many2one) : module is now 'sale_project' ('sale_timesheet') | ||
# NOTHING TO DO | ||
|
||
---XML records in module 'sale_timesheet'--- | ||
NEW ir.actions.act_window: sale_timesheet.project_task_action_multi_create_sale_order | ||
NEW ir.actions.act_window.view: sale_timesheet.timesheet_action_view_report_by_billing_rate_graph | ||
NEW ir.actions.act_window.view: sale_timesheet.timesheet_action_view_report_by_billing_rate_pivot | ||
DEL ir.filters: sale_timesheet.ir_filter_project_profitability_report_manager_and_product | ||
DEL ir.filters: sale_timesheet.timesheet_filter_billing | ||
NEW ir.model.access: sale_timesheet.access_project_create_invoice | ||
NEW ir.model.access: sale_timesheet.access_project_create_sale_order | ||
NEW ir.model.access: sale_timesheet.access_project_create_sale_order_line | ||
NEW ir.model.access: sale_timesheet.access_project_task_create_sale_order | ||
DEL ir.model.access: sale_timesheet.access_sale_order_line_project_manager [renamed to sale_project module] | ||
DEL ir.model.access: sale_timesheet.access_sale_order_project_manager [renamed to sale_project module] | ||
DEL ir.rule: sale_timesheet.sale_order_line_rule_project_manager [renamed to sale_project module] (noupdate) | ||
NEW ir.ui.view: sale_timesheet.portal_my_timesheets_inherit | ||
NEW ir.ui.view: sale_timesheet.project_project_view_form_salesman | ||
NEW ir.ui.view: sale_timesheet.project_project_view_form_simplified_inherit | ||
NEW ir.ui.view: sale_timesheet.project_task_create_sale_order_view_form | ||
NEW ir.ui.view: sale_timesheet.quick_create_task_form_sale_timesheet | ||
NEW ir.ui.view: sale_timesheet.report_invoice_document | ||
NEW ir.ui.view: sale_timesheet.sale_advance_payment_inv_timesheet_view_form | ||
NEW ir.ui.view: sale_timesheet.sale_order_portal_content_inherit | ||
NEW ir.ui.view: sale_timesheet.sale_order_portal_template_inherit | ||
NEW ir.ui.view: sale_timesheet.timesheet_view_tree_sale | ||
NEW ir.ui.view: sale_timesheet.view_hr_timesheet_line_pivot_billing_rate | ||
NEW ir.ui.view: sale_timesheet.view_task_form2_inherit_sale_timesheet | ||
DEL ir.ui.view: sale_timesheet.project_task_view_form_inherit_sale_line_editable | ||
DEL ir.ui.view: sale_timesheet.project_task_view_form_sale_order | ||
DEL ir.ui.view: sale_timesheet.project_task_view_search | ||
NEW product.product: sale_timesheet.time_product (noupdate) | ||
# NOTHING TO DO |