From 94d12ec7d086eb738c29fc044d4e2b38d8a5060d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20=C4=90=E1=BA=A1i=20D=C6=B0=C6=A1ng?= Date: Fri, 7 Jun 2024 10:27:08 +0700 Subject: [PATCH] [MIG] account: migration to 17.0 (#652) * [MIG] account: migration to 17.0 * improve _account_tax_migration --------- Co-authored-by: Roy Le --- docsource/modules160-170.rst | 2 +- .../scripts/account/17.0.1.2/end-migration.py | 13 + .../account/17.0.1.2/post-migration.py | 147 ++++++ .../scripts/account/17.0.1.2/pre-migration.py | 435 ++++++++++++++++++ .../17.0.1.2/upgrade_analysis_work.txt | 104 ++++- 5 files changed, 687 insertions(+), 14 deletions(-) create mode 100644 openupgrade_scripts/scripts/account/17.0.1.2/end-migration.py diff --git a/docsource/modules160-170.rst b/docsource/modules160-170.rst index 4ec2b512e33f..3268948b4278 100644 --- a/docsource/modules160-170.rst +++ b/docsource/modules160-170.rst @@ -6,7 +6,7 @@ Module coverage 16.0 -> 17.0 +---------------------------------------------------+----------------------+-------------------------------------------------+ | Module | Status + Extra Information | +===================================================+======================+=================================================+ -| account |Done (partial) | | +| account |Done | | +---------------------------------------------------+----------------------+-------------------------------------------------+ | |new| account_audit_trail | | | +---------------------------------------------------+----------------------+-------------------------------------------------+ diff --git a/openupgrade_scripts/scripts/account/17.0.1.2/end-migration.py b/openupgrade_scripts/scripts/account/17.0.1.2/end-migration.py new file mode 100644 index 000000000000..6bf5e52c90d0 --- /dev/null +++ b/openupgrade_scripts/scripts/account/17.0.1.2/end-migration.py @@ -0,0 +1,13 @@ +# Copyright 2024 Viindoo Technology Joint Stock Company (Viindoo) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from openupgradelib import openupgrade + + +def _res_partner_bank_computation(env): + partner_banks = env["res.partner.bank"].with_context(active_test=False).search([]) + partner_banks._compute_display_account_warning() + + +@openupgrade.migrate() +def migrate(env, version): + _res_partner_bank_computation(env) diff --git a/openupgrade_scripts/scripts/account/17.0.1.2/post-migration.py b/openupgrade_scripts/scripts/account/17.0.1.2/post-migration.py index f76b7371c68c..b3c5fd100a79 100644 --- a/openupgrade_scripts/scripts/account/17.0.1.2/post-migration.py +++ b/openupgrade_scripts/scripts/account/17.0.1.2/post-migration.py @@ -11,6 +11,150 @@ ] +def _am_update_invoice_pdf_report_file(env): + openupgrade.logged_query( + env.cr, + """ + UPDATE ir_attachment ia + SET res_field = 'invoice_pdf_report_file', + res_id = am.id + FROM account_move am + WHERE am.message_main_attachment_id = ia.id + """, + ) + + +def _onboarding_state_migration(env): + """ + Following pr: https://github.com/odoo/odoo/pull/104223/ + """ + env.cr.execute( + """ + SELECT id, account_onboarding_create_invoice_state_flag, + account_onboarding_invoice_layout_state, + account_onboarding_sale_tax_state, account_setup_bank_data_state, + account_setup_bill_state, account_setup_coa_state, account_setup_fy_data_state, + account_setup_taxes_state FROM res_company + """ + ) + for ( + company_id, + account_onboarding_create_invoice_state_flag, + account_onboarding_invoice_layout_state, + account_onboarding_sale_tax_state, + account_setup_bank_data_state, + account_setup_bill_state, + account_setup_coa_state, + account_setup_fy_data_state, + account_setup_taxes_state, + ) in env.cr.fetchall(): + OnboardingStep = env["onboarding.onboarding.step"].with_company(company_id) + company = env["res.company"].browse(company_id) + if company.street and company.street.strip(): + # Same behaviour for this base setup company data in v16 + # Check method 'action_save_onboarding_company_step' in v16 + # Note in v17 you only need to save it then it will be done + OnboardingStep.action_validate_step( + "account.onboarding_onboarding_step_company_data" + ) + if account_onboarding_create_invoice_state_flag: + step = env.ref( + "account.onboarding_onboarding_step_create_invoice", + raise_if_not_found=False, + ) + if step and step.current_step_state == "not_done": + if env["account.move"].search( + [ + ("company_id", "=", company_id), + ("move_type", "=", "out_invoice"), + ], + limit=1, + ): + step.action_set_just_done() + if account_onboarding_invoice_layout_state in ("just_done", "done"): + step = env.ref( + "account.onboarding_onboarding_step_base_document_layout", + raise_if_not_found=False, + ) + if step: + step.with_company(company_id).action_set_just_done() + if account_onboarding_sale_tax_state in ("just_done", "done"): + OnboardingStep.action_validate_step( + "account.onboarding_onboarding_step_sales_tax" + ) + if account_setup_bank_data_state in ("just_done", "done"): + OnboardingStep.action_validate_step( + "account.onboarding_onboarding_step_bank_account" + ) + if account_setup_bill_state in ("just_done", "done"): + OnboardingStep.action_validate_step( + "account.onboarding_onboarding_step_setup_bill" + ) + if account_setup_coa_state in ("just_done", "done"): + OnboardingStep.action_validate_step( + "account.onboarding_onboarding_step_chart_of_accounts" + ) + if account_setup_fy_data_state in ("just_done", "done"): + OnboardingStep.action_validate_step( + "account.onboarding_onboarding_step_fiscal_year" + ) + if account_setup_taxes_state in ("just_done", "done"): + OnboardingStep.action_validate_step( + "account.onboarding_onboarding_step_default_taxes" + ) + + +def _account_payment_term_migration(env): + """ + In post we will update the value_amount field + to respect v17 to ensure total percentage will not + exceed 100% of not <100% + In v16, the payment term might have some cases like + -Case 1 + line 1: value - balance, value_amount - 0.0 + line 2: value - percent, value_amount - 50 + line 3: value - percent, value_amount - 45 + -Case 2 + line 1: value - balance, value_amount - 0.0 + line 2: value - percent, value_amount - 100 + NOTE: in pre we already convert value_amount of balance to 100.0 % + AFTER migration: line 1 of case 1 will have 'value_amount' is 5% + line 2 of case 2 will have 'value_amount' is 100% while line 2 is 0.0% + """ + payment_terms = ( + env["account.payment.term"].with_context(active_test=False).search([]) + ) + for term in payment_terms: + term_lines = term.line_ids.filtered(lambda line: line.value == "percent") + value_amount_total = sum(term_lines.mapped("value_amount")) + if value_amount_total and value_amount_total > 100.0: + term_lines_with_100_percentage = term_lines.filtered( + lambda line: line.value_amount == 100 + ) + term_lines_below_100_percentage = term_lines.filtered( + lambda line: line.value_amount < 100 + ) + if len(term_lines_with_100_percentage) > 1: + ( + term_lines_with_100_percentage - term_lines_with_100_percentage[0] + ).write( + { + "value_amount": 0.0, + } + ) + if term_lines_below_100_percentage: + remaining_line = term_lines - term_lines_below_100_percentage + if remaining_line: + remaining_line.write( + { + "value_amount": 100 + - sum( + term_lines_below_100_percentage.mapped("value_amount") + ) + } + ) + + @openupgrade.migrate() def migrate(env, version): openupgrade.load_data(env, "account", "17.0.1.2/noupdate_changes.xml") @@ -18,3 +162,6 @@ def migrate(env, version): env, _deleted_xml_records, ) + _am_update_invoice_pdf_report_file(env) + _onboarding_state_migration(env) + _account_payment_term_migration(env) diff --git a/openupgrade_scripts/scripts/account/17.0.1.2/pre-migration.py b/openupgrade_scripts/scripts/account/17.0.1.2/pre-migration.py index 02c221cf76d1..c973f40b6ff6 100644 --- a/openupgrade_scripts/scripts/account/17.0.1.2/pre-migration.py +++ b/openupgrade_scripts/scripts/account/17.0.1.2/pre-migration.py @@ -8,6 +8,19 @@ _logger = logging.getLogger(__name__) +_fields_renames = [ + ( + "res.company", + "res_company", + "invoice_is_print", + "invoice_is_download", + ), +] + +_columns_copies = { + "account_tax": [("description", "invoice_label", "JSONB")], +} + COA_MAPPING = { "l10n_ae.uae_chart_template_standard": "ae", "l10n_ar.l10nar_base_chart_template": "ar_base", @@ -101,6 +114,15 @@ "l10n_za.default_chart_template": "za", } +_l10n_generic_coa_tax_group_xmlid = [ + "l10n_generic_coa.tax_group_15", +] + +_l10n_generic_coa_tax_xmlid = [ + "l10n_generic_coa.sale_tax_template", + "l10n_generic_coa.purchase_tax_template", +] + @api.model_create_multi def create(self, vals_list): @@ -188,11 +210,412 @@ def _map_chart_template_id_to_chart_template( ) +def _generic_coa_rename_xml_id(env): + """ + Since the removal of account.chart.template + we need to rename some xml_id like tax or tax.group + in order to avoid duplication + """ + env.cr.execute( + """SELECT id, name FROM res_company WHERE chart_template = 'generic_coa'""" + ) + xmlids_renames = [] + for company_id, _ in env.cr.fetchall(): + if company_id == env.company.id: + for tax_group_xmlid in _l10n_generic_coa_tax_group_xmlid: + new_xmlid = f"account.{company_id}_" + tax_group_xmlid.split(".")[1] + xmlids_renames.append((tax_group_xmlid, new_xmlid)) + for tax_xmlid in _l10n_generic_coa_tax_xmlid: + old_xmlid = f"l10n_generic_coa.{company_id}_" + tax_xmlid.split(".")[1] + new_xmlid = f"account.{company_id}_" + tax_xmlid.split(".")[1] + xmlids_renames.append((old_xmlid, new_xmlid)) + openupgrade.rename_xmlids(env.cr, xmlids_renames) + + +def _am_create_delivery_date_column(env): + """ + Create column then in module need them like l10n_de and sale_stock will fill value, + https://github.com/odoo/odoo/pull/116643 + """ + openupgrade.logged_query( + env.cr, + """ + ALTER TABLE account_move + ADD COLUMN IF NOT EXISTS delivery_date DATE + """, + ) + + +def _am_create_incoterm_location_column(env): + """ + Create column then in sale_stock, purchase_stock will fill it in pre, + pr: https://github.com/odoo/odoo/pull/118954 + """ + openupgrade.logged_query( + env.cr, + """ + ALTER TABLE account_move + ADD COLUMN IF NOT EXISTS incoterm_location CHARACTER VARYING + """, + ) + + +def _aml_update_invoice_date_like_amount_move(env): + openupgrade.logged_query( + env.cr, + """ + ALTER TABLE account_move_line + ADD COLUMN IF NOT EXISTS invoice_date DATE + """, + ) + openupgrade.logged_query( + env.cr, + """ + UPDATE account_move_line aml + SET invoice_date = am.invoice_date + FROM account_move am + WHERE aml.move_id = am.id + """, + ) + + +def _account_payment_term_migration(env): + """ + https://github.com/odoo/odoo/pull/110274 + """ + openupgrade.logged_query( + env.cr, + """ + ALTER TABLE account_payment_term + ADD COLUMN IF NOT EXISTS discount_days INTEGER, + ADD COLUMN IF NOT EXISTS discount_percentage FLOAT, + ADD COLUMN IF NOT EXISTS early_discount BOOLEAN, + ADD COLUMN IF NOT EXISTS early_pay_discount_computation VARCHAR; + """, + ) + openupgrade.logged_query( + env.cr, + """ + ALTER TABLE account_payment_term_line + ADD COLUMN IF NOT EXISTS delay_type VARCHAR, + ADD COLUMN IF NOT EXISTS nb_days INTEGER; + """, + ) + openupgrade.logged_query( + env.cr, + """ + UPDATE account_payment_term_line + SET value = 'percent', + value_amount = 100.0 + WHERE value = 'balance' + """, + ) + openupgrade.logged_query( + env.cr, + """ + UPDATE account_payment_term_line + SET delay_type = CASE + WHEN end_month = true AND months = 1 THEN 'days_after_end_of_next_month' + WHEN end_month = true AND months > 1 THEN 'days_end_of_month_on_the' + WHEN end_month IN (false, NULL) THEN 'days_after' + ELSE 'days_after' + END, + nb_days = CASE + WHEN months IS NOT NULL AND days_after IS NOT NULL AND end_month = true + AND months > 1 + THEN (months*30) + days + days_after + WHEN months IS NOT NULL AND days_after IS NOT NULL AND end_month = true + AND months = 1 + THEN days + days_after + WHEN end_month IN (false, NULL) THEN (months*30) + days + END + """, + ) + openupgrade.logged_query( + env.cr, + """ + UPDATE account_payment_term term + SET early_pay_discount_computation = com.early_pay_discount_computation + FROM res_company com + WHERE term.company_id = com.id + """, + ) + openupgrade.logged_query( + env.cr, + """ + UPDATE account_payment_term term + SET early_discount = true + WHERE EXISTS ( + SELECT 1 + FROM account_payment_term_line t1 + WHERE t1.payment_id = term.id + AND t1.discount_days IS NOT NULL + AND t1.discount_percentage IS NOT NULL + AND t1.discount_percentage > 0.0 + ); + """, + ) + openupgrade.logged_query( + env.cr, + """ + WITH tmp as( + SELECT payment_id, MAX(discount_days) discount_days, + sum(discount_percentage) discount_percentage + FROM account_payment_term_line + WHERE discount_days IS NOT NULL AND discount_percentage IS NOT NULL + AND discount_percentage > 0.0 + GROUP BY payment_id + ) + UPDATE account_payment_term term + SET discount_days = tmp.discount_days, + discount_percentage = tmp.discount_percentage + FROM tmp + WHERE tmp.payment_id = term.id + """, + ) + + +def _force_install_account_payment_term_module_module(env): + """ + Force install account_payment_term because we need + key 'days_end_of_month_on_the' of it + it has already merged in odoo master + """ + account_payment_term_module = env["ir.module.module"].search( + [("name", "=", "account_payment_term")] + ) + if account_payment_term_module: + account_payment_term_module.button_install() + + +def _account_report_update_figure_type(env): + openupgrade.logged_query( + env.cr, + """ + UPDATE account_report_column + SET figure_type = 'string' + WHERE figure_type = 'none' + """, + ) + openupgrade.logged_query( + env.cr, + """ + UPDATE account_report_expression + SET figure_type = 'string' + WHERE figure_type = 'none' + """, + ) + + +def _account_tax_repartition_line_merge_repartition_lines_m2o(env): + openupgrade.logged_query( + env.cr, + """ + ALTER TABLE account_tax_repartition_line + ADD COLUMN IF NOT EXISTS document_type VARCHAR, + ADD COLUMN IF NOT EXISTS tax_id INTEGER; + """, + ) + openupgrade.logged_query( + env.cr, + """ + UPDATE account_tax_repartition_line + SET document_type = CASE + WHEN invoice_tax_id IS NOT NULL THEN 'invoice' + WHEN refund_tax_id IS NOT NULL THEN 'refund' + END, + tax_id = CASE + WHEN invoice_tax_id IS NOT NULL THEN invoice_tax_id + WHEN refund_tax_id IS NOT NULL THEN refund_tax_id + END + """, + ) + + +def _res_partner_bank_create_column(env): + openupgrade.logged_query( + env.cr, + """ + ALTER TABLE res_partner_bank + ADD COLUMN IF NOT EXISTS has_iban_warning BOOLEAN, + ADD COLUMN IF NOT EXISTS has_money_transfer_warning BOOLEAN; + """, + ) + + +def _account_tax_migration(env): + """ + In v17 tax group is company dependent with each company through company_id field + So this method have following purpose: + -Find which tax group have more than 1 of different company + then duplicate it using insert + -Update the taxes to new duplicate one as well + -Rename ir model data (xml_id), the format will be + "{module_name}.{company_id}_xml_id" + Example in v16: + 2 VN CoA company: tax 0, tax 5, tax 10 + 2 Generic CoA company tax 15 + 1 Belgium CoA company tax 6, 12, 21 + -> After migration we will have 2 tax 0, 2 tax 5, 2 tax 10 + and 2 tax 15 of course with only different company_id + Also the new one will have their own xml_id using create method + of ir.model.data + And then in each l10n module, only need to perform rename xml_id like + https://github.com/Viindoo/OpenUpgrade/pull/655 + """ + openupgrade.logged_query( + env.cr, + """ + ALTER TABLE account_tax_group + ADD COLUMN IF NOT EXISTS company_id INTEGER; + """, + ) + + env.cr.execute( + """ + SELECT + string_agg(column_name, ',') + FROM + information_schema.columns + WHERE + table_name = 'account_tax_group' + AND column_name != 'id' + AND column_name != 'company_id' + """ + ) + account_tax_group_columns = env.cr.fetchone()[0] + + env.cr.execute( + """ + SELECT tax_group_id, array_agg(DISTINCT(company_id)) + FROM account_tax + GROUP BY tax_group_id + """ + ) + + for tax_group_id, company_ids in env.cr.fetchall(): + first_company_id = company_ids[:1] + + imd = env["ir.model.data"].search( + [("res_id", "=", tax_group_id), ("model", "=", "account.tax.group")] + ) + imd.write({"name": f"{first_company_id}_{imd.name}"}) + + for company_id in company_ids[1:]: + env.cr.execute( + f""" + INSERT INTO account_tax_group ({account_tax_group_columns}, company_id) + SELECT {account_tax_group_columns}, {company_id} + FROM account_tax_group + WHERE id = {tax_group_id} + RETURNING id + """ + ) + + new_tax_group_id = env.cr.fetchone()[0] + vals = {"res_id": new_tax_group_id, "name": f"{company_id}_{imd.name}"} + imd.copy(default=vals) + + openupgrade.logged_query( + env.cr, + f""" + UPDATE account_tax + SET tax_group_id = {new_tax_group_id} + WHERE tax_group_id = {tax_group_id} AND company_id = {company_id} + """, + ) + + +def _account_tax_group_update_from_property(env): + openupgrade.logged_query( + env.cr, + """ + ALTER TABLE account_tax_group + ADD COLUMN IF NOT EXISTS advance_tax_payment_account_id INTEGER, + ADD COLUMN IF NOT EXISTS tax_payable_account_id INTEGER, + ADD COLUMN IF NOT EXISTS tax_receivable_account_id INTEGER; + """, + ) + openupgrade.logged_query( + env.cr, + """ + UPDATE account_tax_group atg + SET tax_receivable_account_id = + COALESCE( + ( + SELECT CAST(SPLIT_PART(ip.value_reference, ',', 2) AS int) + FROM ir_property ip + WHERE name = 'property_tax_receivable_account_id' AND + res_id = CONCAT('account.tax.group,', atg.id) AND + company_id = atg.company_id + ), + ( + SELECT CAST(SPLIT_PART(ip.value_reference, ',', 2) AS int) + FROM ir_property ip + WHERE name = 'property_tax_receivable_account_id' AND + (res_id IS NULL OR res_id = '') AND + company_id = atg.company_id + ), + NULL + ) + """, + ) + openupgrade.logged_query( + env.cr, + """ + UPDATE account_tax_group atg + SET tax_payable_account_id = + COALESCE( + ( + SELECT CAST(SPLIT_PART(ip.value_reference, ',', 2) AS int) + FROM ir_property ip + WHERE name = 'property_tax_payable_account_id' AND + res_id = CONCAT('account.tax.group,', atg.id) AND + company_id = atg.company_id + ), + ( + SELECT CAST(SPLIT_PART(ip.value_reference, ',', 2) AS int) + FROM ir_property ip + WHERE name = 'property_tax_payable_account_id' AND + (res_id IS NULL OR res_id = '') AND + company_id = atg.company_id + ), + NULL + ) + """, + ) + openupgrade.logged_query( + env.cr, + """ + UPDATE account_tax_group atg + SET advance_tax_payment_account_id = + COALESCE( + ( + SELECT CAST(SPLIT_PART(ip.value_reference, ',', 2) AS int) + FROM ir_property ip + WHERE name = 'property_advance_tax_payment_account_id' AND + res_id = CONCAT('account.tax.group,', atg.id) AND + company_id = atg.company_id + ), + ( + SELECT CAST(SPLIT_PART(ip.value_reference, ',', 2) AS int) + FROM ir_property ip + WHERE name = 'property_advance_tax_payment_account_id' AND + (res_id IS NULL OR res_id = '') AND + company_id = atg.company_id + ), + NULL + ) + """, + ) + + @openupgrade.migrate() def migrate(env, version): _map_account_report_filter_account_type(env) _map_chart_template_id_to_chart_template(env, "res_company") _map_chart_template_id_to_chart_template(env, "account_report") + _generic_coa_rename_xml_id(env) # Drop triagram index on name column of account.account # to avoid error when loading registry, it will be recreated openupgrade.logged_query( @@ -201,3 +624,15 @@ def migrate(env, version): DROP INDEX IF EXISTS account_account_name_index; """, ) + openupgrade.rename_fields(env, _fields_renames) + openupgrade.copy_columns(env.cr, _columns_copies) + _am_create_delivery_date_column(env) + _am_create_incoterm_location_column(env) + _aml_update_invoice_date_like_amount_move(env) + _force_install_account_payment_term_module_module(env) + _account_payment_term_migration(env) + _account_report_update_figure_type(env) + _account_tax_repartition_line_merge_repartition_lines_m2o(env) + _res_partner_bank_create_column(env) + _account_tax_migration(env) + _account_tax_group_update_from_property(env) diff --git a/openupgrade_scripts/scripts/account/17.0.1.2/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/account/17.0.1.2/upgrade_analysis_work.txt index db62a5395e72..ade9aa12c506 100644 --- a/openupgrade_scripts/scripts/account/17.0.1.2/upgrade_analysis_work.txt +++ b/openupgrade_scripts/scripts/account/17.0.1.2/upgrade_analysis_work.txt @@ -4,17 +4,23 @@ obsolete model account.fiscal.position.account.template obsolete model account.fiscal.position.tax.template obsolete model account.fiscal.position.template obsolete model account.group.template -obsolete model account.invoice.send [transient] obsolete model account.reconcile.model.line.template obsolete model account.reconcile.model.template obsolete model account.tax.repartition.line.template obsolete model account.tax.template +# NOTHING TO DO: these models has been convert to csv definition + +obsolete model account.invoice.send [transient] new model account.move.send [transient] +# NOTHING TO DO + ---Fields in module 'account'--- account / account.account / _order : _order is now 'code, company_id' ('is_off_balance, code, company_id') account / account.account / is_off_balance (boolean) : DEL account / account.account / message_main_attachment_id (many2one): DEL relation: ir.attachment account / account.account / rating_ids (one2many) : NEW relation: rating.rating +# NOTHING TO DO + account / account.account.template / account_type (selection) : DEL selection_keys: ['asset_cash', 'asset_current', 'asset_fixed', 'asset_non_current', 'asset_prepayments', 'asset_receivable', 'equity', 'equity_unaffected', 'expense', 'expense_depreciation', 'expense_direct_cost', 'income', 'income_other', 'liability_credit_card', 'liability_current', 'liability_non_current', 'liability_payable', 'off_balance'] account / account.account.template / chart_template_id (many2one) : DEL relation: account.chart.template account / account.account.template / code (char) : DEL required @@ -86,12 +92,19 @@ account / account.fiscal.position.template / tax_ids (one2many) account / account.fiscal.position.template / vat_required (boolean) : DEL account / account.fiscal.position.template / zip_from (char) : DEL account / account.fiscal.position.template / zip_to (char) : DEL +# NOTHING TO DO + account / account.full.reconcile / name (char) : DEL required +account / account.move.line / matching_number (char) : not a function anymore +# NOTHING TO DO + account / account.group.template / chart_template_id (many2one) : DEL relation: account.chart.template, required account / account.group.template / code_prefix_end (char) : DEL account / account.group.template / code_prefix_start (char) : DEL account / account.group.template / name (char) : DEL required account / account.group.template / parent_id (many2one) : DEL relation: account.group.template +# NOTHING TO DO + account / account.journal / access_token (char) : NEW account / account.journal / activity_user_id (many2one) : not related anymore account / account.journal / activity_user_id (many2one) : now a function @@ -104,23 +117,46 @@ account / account.journal / rating_ids (one2many) : NEW re account / account.move / _order : _order is now 'date desc, name desc, invoice_date desc, id desc' ('date desc, name desc, id desc') account / account.move / activity_user_id (many2one) : not related anymore account / account.move / activity_user_id (many2one) : now a function +# NOTHING TO DO + account / account.move / amount_total_words (char) : previously in module l10n_dz +# NOTHING TO DO: compute no store + account / account.move / delivery_date (date) : NEW isfunction: function, stored +# DONE pre-migration: Create column then in module need them like l10n_de and sale_stock will fill value, https://github.com/odoo/odoo/pull/116643 + account / account.move / incoterm_location (char) : NEW hasdefault: compute +# DONE pre-migration: Create column then in sale_stock, purchase_stock will fill it in pre, pr: https://github.com/odoo/odoo/pull/118954 + account / account.move / invoice_pdf_report_file (binary): NEW attachment: True +# DONE post-migration: update message_main_attachment_id with res_field and res_id of each invoice, see '_link_invoice_documents' in 'account.move.send' + account / account.move / rating_ids (one2many) : NEW relation: rating.rating account / account.move / send_and_print_values (json) : NEW +# NOTHING TO DO + account / account.move.line / discount_percentage (float) : DEL account / account.move.line / display_type (selection) : selection_keys is now '['cogs', 'discount', 'epd', 'line_note', 'line_section', 'payment_term', 'product', 'rounding', 'tax']' ('['cogs', 'epd', 'line_note', 'line_section', 'payment_term', 'product', 'rounding', 'tax']') +# NOTHING TO DO: new feature https://github.com/odoo/odoo/pull/133286 + account / account.move.line / invoice_date (date) : NEW isrelated: related, stored -account / account.move.line / matching_number (char) : not a function anymore +# DONE pre-migration: create column and fill value + account / account.move.line / tax_audit (char) : DEL +# NOTHING TO DO: deprecated + account / account.partial.reconcile / company_id (many2one) : not related anymore +# NOTHING TO DO + account / account.payment / activity_user_id (many2one) : not related anymore account / account.payment / activity_user_id (many2one) : now a function account / account.payment / amount_total_words (char) : previously in module l10n_dz -account / account.payment / qr_code (char) : type is now 'html' ('char') account / account.payment / rating_ids (one2many) : NEW relation: rating.rating +# NOTHING TO DO + +account / account.payment / qr_code (char) : type is now 'html' ('char') +# NOTHING TO DO: no store field + account / account.payment.term / currency_id (many2one) : NEW relation: res.currency, hasdefault: default account / account.payment.term / discount_days (integer) : NEW hasdefault: default account / account.payment.term / discount_percentage (float) : NEW hasdefault: default @@ -135,6 +171,8 @@ account / account.payment.term.line / end_month (boolean) : DEL account / account.payment.term.line / months (integer) : DEL required account / account.payment.term.line / nb_days (integer) : NEW hasdefault: compute account / account.payment.term.line / value (selection) : selection_keys is now '['fixed', 'percent']' ('['balance', 'fixed', 'percent']') +# DONE pre-migration: update discount_percentage (sum of all line percentage), delay_type, value (replace balance with percentage) https://github.com/odoo/odoo/pull/110274/ + account / account.reconcile.model / message_main_attachment_id (many2one): DEL relation: ir.attachment account / account.reconcile.model / rating_ids (one2many) : NEW relation: rating.rating account / account.reconcile.model.line.template / account_id (many2one) : DEL relation: account.account.template @@ -177,14 +215,14 @@ account / account.reconcile.model.template / sequence (integer) account / account.reconcile.model.template / to_check (boolean) : DEL account / account.report / _order : _order is now 'sequence, id' ('id') account / account.report / active (boolean) : NEW hasdefault: default -# TODO +# NOTHING TO DO account / account.report / chart_template (selection) : NEW selection_keys: function account / account.report / chart_template_id (many2one) : DEL relation: account.chart.template # DONE: map chart_template_id > chart_template in pre-migration account / account.report / default_opening_date_filter (selection): selection_keys is now '['last_month', 'last_quarter', 'last_tax_period', 'last_year', 'this_month', 'this_quarter', 'this_tax_period', 'this_year', 'today']' ('['last_month', 'last_quarter', 'last_year', 'this_month', 'this_quarter', 'this_year', 'today']') -# TODO +# NOTHING TO DO: new feature account / account.report / filter_account_type (boolean) : selection_keys is now '['both', 'disabled', 'payable', 'receivable']' ('False') account / account.report / filter_account_type (boolean) : type is now 'selection' ('boolean') @@ -197,28 +235,48 @@ account / account.report / section_main_report_ids (many2many): N account / account.report / section_report_ids (many2many): NEW relation: account.report account / account.report / sequence (integer) : NEW account / account.report / use_sections (boolean) : NEW hasdefault: compute -account / account.report.column / figure_type (selection) : selection_keys is now '['boolean', 'date', 'datetime', 'float', 'integer', 'monetary', 'percentage', 'string']' ('['date', 'datetime', 'float', 'integer', 'monetary', 'none', 'percentage']') -account / account.report.expression / figure_type (selection) : selection_keys is now '['boolean', 'date', 'datetime', 'float', 'integer', 'monetary', 'percentage', 'string']' ('['date', 'datetime', 'float', 'integer', 'monetary', 'none', 'percentage']') account / account.report.external.value / text_value (char) : NEW account / account.report.line / external_formula (char) : NEW account / account.report.line / user_groupby (char) : NEW +# NOTHING TO DO: probably need to do in module that add Localization report + +account / account.report.column / figure_type (selection) : selection_keys is now '['boolean', 'date', 'datetime', 'float', 'integer', 'monetary', 'percentage', 'string']' ('['date', 'datetime', 'float', 'integer', 'monetary', 'none', 'percentage']') +account / account.report.expression / figure_type (selection) : selection_keys is now '['boolean', 'date', 'datetime', 'float', 'integer', 'monetary', 'percentage', 'string']' ('['date', 'datetime', 'float', 'integer', 'monetary', 'none', 'percentage']') +# DONE pre-migration: update none -> string + account / account.tax / invoice_label (char) : NEW +# DONE pre-migration: create jsonb column(because translate=True) and fill value with 'description' field https://github.com/odoo/odoo/pull/113236/commits + account / account.tax / message_follower_ids (one2many): NEW relation: mail.followers account / account.tax / message_ids (one2many) : NEW relation: mail.message account / account.tax / rating_ids (one2many) : NEW relation: rating.rating +# NOTHING TO DO + account / account.tax / real_amount (float) : DEL +# NOTHING TO DO + account / account.tax / repartition_line_ids (one2many): NEW relation: account.tax.repartition.line -account / account.tax / website_message_ids (one2many): NEW relation: mail.message +# NOTHING TO DO: https://github.com/odoo/odoo/pull/110016/commits/a4c1f62ebd2710b3810c2d01195d88e4a9f13a9f + +account / account.tax / website_message_ids (one2many): NEW relation: mail.messag +# NOTHING TO DO + account / account.tax.group / advance_tax_payment_account_id (many2one): NEW relation: account.account -account / account.tax.group / company_id (many2one) : NEW relation: res.company, required, hasdefault: default account / account.tax.group / property_advance_tax_payment_account_id (many2one): DEL relation: account.account account / account.tax.group / property_tax_payable_account_id (many2one): DEL relation: account.account account / account.tax.group / property_tax_receivable_account_id (many2one): DEL relation: account.account account / account.tax.group / tax_payable_account_id (many2one): NEW relation: account.account account / account.tax.group / tax_receivable_account_id (many2one): NEW relation: account.account +# DONE pre-migration: update value base on ir.property + +account / account.tax.group / company_id (many2one) : NEW relation: res.company, required, hasdefault: default +# DONE pre-migration: create column and fill value base on account.tax + account / account.tax.repartition.line / _order : _order is now 'document_type, repartition_type, sequence, id' ('sequence, repartition_type, id') account / account.tax.repartition.line / company_id (many2one) : not a function anymore account / account.tax.repartition.line / company_id (many2one) : now related +# NOTHING TO DO + account / account.tax.repartition.line / document_type (selection) : is now stored account / account.tax.repartition.line / document_type (selection) : not a function anymore account / account.tax.repartition.line / document_type (selection) : now required @@ -226,6 +284,8 @@ account / account.tax.repartition.line / invoice_tax_id (many2one) : DE account / account.tax.repartition.line / refund_tax_id (many2one) : DEL relation: account.tax account / account.tax.repartition.line / tax_id (many2one) : is now stored account / account.tax.repartition.line / tax_id (many2one) : not a function anymore +# DONE : fill document_type and tax_id base on invoice_tax_id and refund_tax_id https://github.com/odoo/odoo/pull/110016/commits/a4c1f62ebd2710b3810c2d01195d88e4a9f13a9f + account / account.tax.repartition.line.template / account_id (many2one) : DEL relation: account.account.template account / account.tax.repartition.line.template / factor_percent (float) : DEL required account / account.tax.repartition.line.template / invoice_tax_id (many2one) : DEL relation: account.tax.template @@ -254,9 +314,9 @@ account / account.tax.template / tax_exigibility (selection) : DEL se account / account.tax.template / tax_group_id (many2one) : DEL relation: account.tax.group account / account.tax.template / tax_scope (selection) : DEL selection_keys: ['consu', 'service'] account / account.tax.template / type_tax_use (selection) : DEL required, selection_keys: ['none', 'purchase', 'sale'] +# NOTHING TO DO + account / res.company / account_dashboard_onboarding_state (selection): DEL selection_keys: ['closed', 'done', 'just_done', 'not_done'] -account / res.company / account_discount_expense_allocation_id (many2one): NEW relation: account.account -account / res.company / account_discount_income_allocation_id (many2one): NEW relation: account.account account / res.company / account_invoice_onboarding_state (selection): DEL selection_keys: ['closed', 'done', 'just_done', 'not_done'] account / res.company / account_onboarding_create_invoice_state_flag (boolean): DEL account / res.company / account_onboarding_invoice_layout_state (selection): DEL selection_keys: ['done', 'just_done', 'not_done'] @@ -266,29 +326,47 @@ account / res.company / account_setup_bill_state (selection): account / res.company / account_setup_coa_state (selection): DEL selection_keys: ['done', 'just_done', 'not_done'] account / res.company / account_setup_fy_data_state (selection): DEL selection_keys: ['done', 'just_done', 'not_done'] account / res.company / account_setup_taxes_state (selection): DEL selection_keys: ['done', 'just_done', 'not_done'] -# TODO +# DONE post-migration: update base on onboarding module + +account / res.company / account_discount_expense_allocation_id (many2one): NEW relation: account.account +account / res.company / account_discount_income_allocation_id (many2one): NEW relation: account.account +# NOTHING TO DO: new feature account / res.company / chart_template (selection) : NEW selection_keys: function account / res.company / chart_template_id (many2one) : DEL relation: account.chart.template # DONE: map chart_template_id > chart_template in pre-migration account / res.company / display_invoice_amount_total_words (boolean): NEW +# NOTHING TO DO: new feature + account / res.company / early_pay_discount_computation (selection): DEL selection_keys: ['excluded', 'included', 'mixed'] +# DONE pre-migration: Update in all payment terms of every company + account / res.company / invoice_is_download (boolean) : NEW hasdefault: default account / res.company / invoice_is_print (boolean) : DEL +# DONE pre-migration: rename field https://github.com/odoo/odoo/pull/119397 + account / res.company / message_main_attachment_id (many2one): DEL relation: ir.attachment +# NOTHING TO DO + account / res.company / property_stock_account_input_categ_id (many2one): DEL relation: account.account account / res.company / property_stock_account_output_categ_id (many2one): DEL relation: account.account account / res.company / property_stock_valuation_account_id (many2one): DEL relation: account.account +# NOTHING TO DO + account / res.company / rating_ids (one2many) : NEW relation: rating.rating account / res.partner.bank / activity_user_id (many2one) : not related anymore account / res.partner.bank / activity_user_id (many2one) : now a function +# NOTHING TO DO + account / res.partner.bank / has_iban_warning (boolean) : NEW isfunction: function, stored account / res.partner.bank / has_money_transfer_warning (boolean): NEW isfunction: function, stored +# DONE create column in pre-migration and compute using orm in end-migration + account / res.partner.bank / message_main_attachment_id (many2one): DEL relation: ir.attachment account / res.partner.bank / rating_ids (one2many) : NEW relation: rating.rating account / res.partner.bank / related_moves (one2many) : NEW relation: account.move -# TODO +# NOTHING TO DO ---XML records in module 'account'--- DEL account.payment.term: account.account_payment_term_2months (noupdate)