Manage renamed move_type column

OpenUpgrade renames the column to its legacy name.
Enterprise renames to move_type_custom.
This commit is contained in:
SimoRubi
2021-04-16 16:00:51 +02:00
committed by Borruso
parent 78617e5663
commit 81c9a3aa8b
2 changed files with 35 additions and 26 deletions

View File

@@ -9,20 +9,21 @@ msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-27 12:02+0000\n"
"PO-Revision-Date: 2018-03-27 12:02+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"PO-Revision-Date: 2021-07-02 22:50+0000\n"
"Last-Translator: Pedro Castro Silva <pedrocs@exo.pt>\n"
"Language-Team: Portuguese (https://www.transifex.com/oca/teams/23907/pt/)\n"
"Language: pt\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Weblate 4.3.2\n"
#. module: account_tax_balance
#: code:addons/account_tax_balance/wizard/open_tax_balances.py:0
#, python-format
msgid "%(name)s: %(target)s from %(from)s to %(to)s"
msgstr ""
msgstr "%(name)s: %(target)s de %(from)s até %(to)s"
#. module: account_tax_balance
#: model_terms:ir.ui.view,arch_db:account_tax_balance.view_tax_search_balance
@@ -72,9 +73,8 @@ msgstr "Cancelar"
#. module: account_tax_balance
#: model:ir.model.fields,field_description:account_tax_balance.field_wizard_open_tax_balances__company_ids
#, fuzzy
msgid "Companies"
msgstr "Empresa"
msgstr "Empresas"
#. module: account_tax_balance
#: model:ir.model.fields,field_description:account_tax_balance.field_wizard_open_tax_balances__create_uid
@@ -88,7 +88,6 @@ msgstr "Criado em"
#. module: account_tax_balance
#: model:ir.model.fields,field_description:account_tax_balance.field_wizard_open_tax_balances__date_range_id
#, fuzzy
msgid "Date Range"
msgstr "Período"
@@ -99,9 +98,8 @@ msgstr "Exibir nome"
#. module: account_tax_balance
#: model:ir.model.fields,field_description:account_tax_balance.field_wizard_open_tax_balances__from_date
#, fuzzy
msgid "From Date"
msgstr "Da data"
msgstr "Data Inicial"
#. module: account_tax_balance
#: model_terms:ir.ui.view,arch_db:account_tax_balance.view_tax_search_balance
@@ -120,14 +118,13 @@ msgstr "ID"
#. module: account_tax_balance
#: model:ir.model,name:account_tax_balance.model_account_move
#, fuzzy
msgid "Journal Entries"
msgstr "Todos os lançamentos"
msgstr "Itens de Diários"
#. module: account_tax_balance
#: model:ir.model,name:account_tax_balance.model_account_move_line
msgid "Journal Item"
msgstr ""
msgstr "Item de Diário"
#. module: account_tax_balance
#: model:ir.model.fields,field_description:account_tax_balance.field_wizard_open_tax_balances____last_update
@@ -146,9 +143,8 @@ msgstr "Última atualização por"
#. module: account_tax_balance
#: model:ir.model.fields,field_description:account_tax_balance.field_account_move__move_type
#, fuzzy
msgid "Move Type"
msgstr "Tipo de movimento"
msgstr "Tipo de Movimento"
#. module: account_tax_balance
#: model_terms:ir.ui.view,arch_db:account_tax_balance.view_account_move_filter
@@ -198,7 +194,7 @@ msgstr "Saldo de impostos"
#. module: account_tax_balance
#: model:ir.model.fields,field_description:account_tax_balance.field_wizard_open_tax_balances__to_date
msgid "To Date"
msgstr ""
msgstr "Data Final"
#. module: account_tax_balance
#: model_terms:ir.ui.view,arch_db:account_tax_balance.view_tax_tree_balance
@@ -253,9 +249,8 @@ msgstr "Ver linhas de imposto de faturas"
#. module: account_tax_balance
#: model:ir.model,name:account_tax_balance.model_wizard_open_tax_balances
#, fuzzy
msgid "Wizard Open Tax Balances"
msgstr "wizard.open.tax.balances"
msgstr "Assistente de Saldos de Impostos Abertos"
#. module: account_tax_balance
#: model_terms:ir.ui.view,arch_db:account_tax_balance.wizard_open_tax_balances

View File

@@ -1,17 +1,31 @@
# Copyright 2020 Ozono Multimedia S.L.L.
# Copyright 2021 Simone Rubino - Agile Business Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openupgradelib import openupgrade
field_renames = [
(
"account.move",
"account_move",
"move_type",
"financial_type",
),
]
@openupgrade.migrate()
def migrate(env, version):
openupgrade.rename_fields(env, field_renames)
"""
Column `move_type` of table `account_move` has been renamed to `financial_type`
because `move_type` is now used by the core,
so the column is moved during migration of module `account` in the core.
Enterprise renames it to `move_type_custom`;
OpenUpgrade renames it to its legacy name.
Move data from the renamed column to the new `financial_type` column.
"""
old_move_type_column = "move_type"
new_move_type_column = "financial_type"
move_table_name = "account_move"
enterprise_move_type_rename = "move_type_custom"
ou_move_type_rename = openupgrade.get_legacy_name(old_move_type_column)
for move_type_rename in (enterprise_move_type_rename, ou_move_type_rename):
if openupgrade.column_exists(env.cr, move_table_name, move_type_rename):
openupgrade.rename_columns(
env.cr,
{
move_table_name: [(move_type_rename, new_move_type_column)],
},
)
break