-
-
Notifications
You must be signed in to change notification settings - Fork 706
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 #4070 from ngochung207-viindoo/16.0-mig-account
[16.0][OU-ADD] account: Migration
- Loading branch information
Showing
6 changed files
with
1,068 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
53 changes: 53 additions & 0 deletions
53
openupgrade_scripts/scripts/account/16.0.1.2/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,53 @@ | ||
# Copyright 2023 Viindoo - Trịnh Ngọc Hưng | ||
# Copyright 2023 Tecnativa - Pedro M. Baeza | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
from openupgradelib import openupgrade | ||
|
||
_translations_to_delete = [ | ||
"email_template_edi_credit_note", | ||
"email_template_edi_invoice", | ||
"mail_template_data_payment_receipt", | ||
] | ||
_deleted_xml_records = [ | ||
"account.data_account_off_sheet", | ||
"account.data_account_type_credit_card", | ||
"account.data_account_type_current_assets", | ||
"account.data_account_type_current_liabilities", | ||
"account.data_account_type_depreciation", | ||
"account.data_account_type_direct_costs", | ||
"account.data_account_type_equity", | ||
"account.data_account_type_expenses", | ||
"account.data_account_type_fixed_assets", | ||
"account.data_account_type_liquidity", | ||
"account.data_account_type_non_current_assets", | ||
"account.data_account_type_non_current_liabilities", | ||
"account.data_account_type_other_income", | ||
"account.data_account_type_payable", | ||
"account.data_account_type_prepayments", | ||
"account.data_account_type_receivable", | ||
"account.data_account_type_revenue", | ||
"account.data_unaffected_earnings", | ||
"account.account_tax_carryover_line_comp_rule", | ||
"account.analytic_default_comp_rule", | ||
] | ||
|
||
|
||
def _compute_remaining_account_payment_amount_company_currency_signed(env): | ||
"""Those payment with different currency than the company ones are not easily | ||
computed by SQL, so we use ORM for these cases, but they should luckily be few. | ||
""" | ||
payments = env["account.payment"].search( | ||
[("amount_company_currency_signed", "=", False)] | ||
) | ||
payments._compute_amount_company_currency_signed() | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
openupgrade.load_data(env.cr, "account", "16.0.1.2/noupdate_changes.xml") | ||
openupgrade.delete_record_translations(env.cr, "account", _translations_to_delete) | ||
openupgrade.delete_records_safely_by_xml_id( | ||
env, | ||
_deleted_xml_records, | ||
) | ||
_compute_remaining_account_payment_amount_company_currency_signed(env) |
Oops, something went wrong.