Skip to content

Commit

Permalink
Merge pull request OCA#10 from tranngocson1996/merged_from_upstream_1…
Browse files Browse the repository at this point in the history
…4_220105_01

Merged from upstream 14 220105 01
  • Loading branch information
royle-vietnam authored Jan 6, 2022
2 parents 1ac5ed8 + a0b8785 commit 3f3df23
Show file tree
Hide file tree
Showing 7 changed files with 242 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/modules130-140.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ <h1>Module coverage 13.0 -&gt; 14.0<a class="headerlink" href="#module-coverage-
<td></td>
</tr>
<tr class="row-odd"><td><p><img alt="new" src="_images/new.png" /> account_edi</p></td>
<td></td>
<td><p>Nothing to do</p></td>
</tr>
<tr class="row-even"><td><p><img alt="new" src="_images/new.png" /> account_edi_extended</p></td>
<td></td>
Expand Down Expand Up @@ -974,7 +974,7 @@ <h1>Module coverage 13.0 -&gt; 14.0<a class="headerlink" href="#module-coverage-
<td></td>
</tr>
<tr class="row-odd"><td><p>sale_timesheet</p></td>
<td></td>
<td><p>Done</p></td>
</tr>
<tr class="row-even"><td><p><img alt="new" src="_images/new.png" /> sale_timesheet_edit</p></td>
<td></td>
Expand Down
4 changes: 2 additions & 2 deletions docsource/modules130-140.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Module coverage 13.0 -> 14.0
+--------------------------------------------+-------------------------------------------------+
|account_debit_note | |
+--------------------------------------------+-------------------------------------------------+
| |new| account_edi | |
| |new| account_edi | Nothing to do |
+--------------------------------------------+-------------------------------------------------+
| |new| account_edi_extended | |
+--------------------------------------------+-------------------------------------------------+
Expand Down Expand Up @@ -616,7 +616,7 @@ Module coverage 13.0 -> 14.0
+--------------------------------------------+-------------------------------------------------+
| |new| sale_stock_margin | |
+--------------------------------------------+-------------------------------------------------+
|sale_timesheet | |
|sale_timesheet | Done |
+--------------------------------------------+-------------------------------------------------+
| |new| sale_timesheet_edit | |
+--------------------------------------------+-------------------------------------------------+
Expand Down
22 changes: 22 additions & 0 deletions openupgrade_scripts/scripts/account/14.0.1.1/pre-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,27 @@ def add_move_id_field_account_payment(env):
)


def add_edi_state_field_account_move(env):
"""
Module account_edi: Created edi_state column and set the default value is false
"""
if not openupgrade.column_exists(env.cr, "account_move", "edi_state"):
openupgrade.logged_query(
env.cr,
"""
ALTER TABLE account_move
ADD COLUMN edi_state varchar
""",
)
openupgrade.logged_query(
env.cr,
"""
UPDATE account_move
SET edi_state = false
""",
)


def fill_empty_partner_type_account_payment(env):
openupgrade.logged_query(
env.cr,
Expand Down Expand Up @@ -383,6 +404,7 @@ def migrate(env, version):
remove_constrains_reconcile_models(env)
add_move_id_field_account_payment(env)
add_move_id_field_account_bank_statement_line(env)
add_edi_state_field_account_move(env)
fill_empty_partner_type_account_payment(env)
fill_account_move_line_currency_id(env)
fill_account_payment_partner_id(env)
Expand Down
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
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")
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"
)
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

0 comments on commit 3f3df23

Please sign in to comment.