Skip to content

Commit

Permalink
Merge pull request #1635 from OCA/16.0
Browse files Browse the repository at this point in the history
Syncing from upstream OCA/account-financial-tools (16.0)
  • Loading branch information
bt-admin authored Nov 8, 2024
2 parents 9ec667c + 81031f9 commit 172e805
Show file tree
Hide file tree
Showing 27 changed files with 996 additions and 204 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ addon | version | maintainers | summary
[account_asset_transfer](account_asset_transfer/) | 16.0.1.0.0 | [![kittiu](https://github.com/kittiu.png?size=30px)](https://github.com/kittiu) | Asset Transfer from AUC to Asset
[account_bank_statement_chatter](account_bank_statement_chatter/) | 16.0.1.0.0 | [![cubells](https://github.com/cubells.png?size=30px)](https://github.com/cubells) | Chatter on bank statements
[account_cash_deposit](account_cash_deposit/) | 16.0.1.2.0 | | Manage cash deposits and cash orders
[account_chart_update](account_chart_update/) | 16.0.2.0.5 | | Wizard to update a company's account chart from a template
[account_chart_update](account_chart_update/) | 16.0.2.0.6 | | Wizard to update a company's account chart from a template
[account_chart_update_l10n_eu_oss_oca](account_chart_update_l10n_eu_oss_oca/) | 16.0.1.0.0 | [![LoisRForgeFlow](https://github.com/LoisRForgeFlow.png?size=30px)](https://github.com/LoisRForgeFlow) | Account Chart update OSS OCA
[account_chart_update_multilang](account_chart_update_multilang/) | 16.0.1.0.1 | [![edlopen](https://github.com/edlopen.png?size=30px)](https://github.com/edlopen) [![rafaelbn](https://github.com/rafaelbn.png?size=30px)](https://github.com/rafaelbn) | Update tax and fiscal position templates with multilang
[account_fiscal_month](account_fiscal_month/) | 16.0.1.1.0 | | Provide a fiscal month date range type
[account_fiscal_position_vat_check](account_fiscal_position_vat_check/) | 16.0.1.1.0 | | Check VAT on invoice validation
[account_fiscal_year](account_fiscal_year/) | 16.0.1.2.0 | [![eLBati](https://github.com/eLBati.png?size=30px)](https://github.com/eLBati) | Create Account Fiscal Year
Expand Down
2 changes: 1 addition & 1 deletion account_chart_update/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Detect changes and update the Account Chart from a template
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:3eaeac6f22fe5dbcad52cd4bff9b28940fc4091346fde69ddbe48177d65cac2c
!! source digest: sha256:9988bf819371083db91d748bb3f41391e402477979cde8d32ff34ce07e86bc8e
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down
2 changes: 1 addition & 1 deletion account_chart_update/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{
"name": "Detect changes and update the Account Chart from a template",
"summary": "Wizard to update a company's account chart from a template",
"version": "16.0.2.0.5",
"version": "16.0.2.0.6",
"author": "Tecnativa, BCIM, Okia, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-financial-tools",
"depends": ["account"],
Expand Down
2 changes: 1 addition & 1 deletion account_chart_update/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Detect changes and update the Account Chart from a template</h
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:3eaeac6f22fe5dbcad52cd4bff9b28940fc4091346fde69ddbe48177d65cac2c
!! source digest: sha256:9988bf819371083db91d748bb3f41391e402477979cde8d32ff34ce07e86bc8e
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/account-financial-tools/tree/16.0/account_chart_update"><img alt="OCA/account-financial-tools" src="https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-financial-tools-16-0/account-financial-tools-16-0-account_chart_update"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/account-financial-tools&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This is a pretty useful tool to update Odoo installations after tax reforms
Expand Down
2 changes: 1 addition & 1 deletion account_chart_update/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import common
from . import test_account_chart_update
196 changes: 196 additions & 0 deletions account_chart_update/tests/common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
# Copyright 2023 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.tests import common, tagged


@tagged("-at_install", "post_install")
class TestAccountChartUpdateCommon(common.TransactionCase):
@classmethod
def _create_xml_id(cls, record):
return cls.env["ir.model.data"].create(
{
"module": "account_chart_update",
"name": "{}-{}".format(record._table, record.id),
"model": record._name,
"res_id": record.id,
}
)

@classmethod
def _create_account_tmpl(cls, name, code, account_type, chart_template):
record = cls.env["account.account.template"].create(
{
"name": name,
"code": code,
"account_type": account_type,
"chart_template_id": chart_template and chart_template.id,
}
)
cls._create_xml_id(record)
return record

@classmethod
def _create_tax_tmpl(cls, name, chart_template):
record = cls.env["account.tax.template"].create(
{
"name": name,
"amount": 0,
"chart_template_id": chart_template.id,
"tax_group_id": cls.env.ref("account.tax_group_taxes").id,
"refund_repartition_line_ids": [
(0, 0, {"repartition_type": "base", "factor_percent": 100.0}),
(0, 0, {"repartition_type": "tax", "factor_percent": 100.0}),
(0, 0, {"repartition_type": "tax", "factor_percent": 100.0}),
],
"invoice_repartition_line_ids": [
(0, 0, {"repartition_type": "base", "factor_percent": 100.0}),
(0, 0, {"repartition_type": "tax", "factor_percent": 100.0}),
(0, 0, {"repartition_type": "tax", "factor_percent": 100.0}),
],
}
)
cls._create_xml_id(record)
return record

def _create_tax_template_with_account(self, name, chart_template, account):
record = self.env["account.tax.template"].create(
{
"name": name,
"amount": 0,
"chart_template_id": chart_template.id,
"tax_group_id": self.env.ref("account.tax_group_taxes").id,
"refund_repartition_line_ids": [
(0, 0, {"repartition_type": "base", "factor_percent": 100.0}),
(
0,
0,
{
"repartition_type": "tax",
"factor_percent": 100.0,
"account_id": account.id,
},
),
],
"invoice_repartition_line_ids": [
(0, 0, {"repartition_type": "base", "factor_percent": 100.0}),
(
0,
0,
{
"repartition_type": "tax",
"factor_percent": 100.0,
"account_id": account.id,
},
),
],
}
)
self._create_xml_id(record)
return record

@classmethod
def _create_fp_tmpl(cls, name, chart_template):
record = cls.env["account.fiscal.position.template"].create(
{"name": name, "chart_template_id": chart_template.id}
)
cls._create_xml_id(record)
return record

def _get_model_data(self, record):
return self.env["ir.model.data"].search(
[("model", "=", record._name), ("res_id", "=", record.id)]
)

@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(
context=dict(
cls.env.context,
mail_create_nolog=True,
mail_create_nosubscribe=True,
mail_notrack=True,
no_reset_password=True,
tracking_disable=True,
)
)
cls.account_template = cls._create_account_tmpl(
"Test", "100000", "income", False
)
cls.chart_template = cls.env["account.chart.template"].create(
{
"name": "Test account_chart_update chart",
"currency_id": cls.env.ref("base.EUR").id,
"code_digits": 6,
"cash_account_code_prefix": "570",
"bank_account_code_prefix": "572",
"transfer_account_code_prefix": "100000",
"property_account_receivable_id": cls.account_template.id,
"property_account_payable_id": cls.account_template.id,
"property_account_expense_categ_id": cls.account_template.id,
"property_account_income_categ_id": cls.account_template.id,
}
)
cls.account_template.chart_template_id = cls.chart_template.id
cls.account_template_pl = cls._create_account_tmpl(
"Undistributed Profits/Losses",
"999999",
"equity",
cls.chart_template,
)
cls.tax_template = cls._create_tax_tmpl("Test tax", cls.chart_template)
cls.fp_template = cls._create_fp_tmpl("Test fp", cls.chart_template)
cls.fp_template_tax = cls.env["account.fiscal.position.tax.template"].create(
{"tax_src_id": cls.tax_template.id, "position_id": cls.fp_template.id}
)
cls._create_xml_id(cls.fp_template_tax)
cls.fp_template_account = cls.env[
"account.fiscal.position.account.template"
].create(
{
"account_src_id": cls.account_template.id,
"account_dest_id": cls.account_template.id,
"position_id": cls.fp_template.id,
}
)
cls._create_xml_id(cls.fp_template_account)
cls.tax_group = cls.env["account.tax.group"].create({"name": "Test tax group"})
cls.account_tag_1 = cls.env["account.account.tag"].create(
{"name": "Test account tag 1"}
)
cls.account_tag_2 = cls.env["account.account.tag"].create(
{"name": "Test account tag 2"}
)
cls.company = cls.env["res.company"].create(
{
"name": "Test account_chart_update company",
"currency_id": cls.chart_template.currency_id.id,
"country_id": cls.env.ref("base.es").id,
}
)
chart_by_company_user = cls.chart_template.with_company(cls.company)
chart_by_company_user.try_loading()
cls.tax = cls.env["account.tax"].search(
[
("name", "=", cls.tax_template.name),
("company_id", "=", cls.company.id),
]
)
cls.account = cls.env["account.account"].search(
[
("code", "=", cls.account_template.code),
("company_id", "=", cls.company.id),
]
)
cls.fp = cls.env["account.fiscal.position"].search(
[("name", "=", cls.fp_template.name), ("company_id", "=", cls.company.id)]
)
# Prepare wizard values
cls.wizard_obj = cls.env["wizard.update.charts.accounts"]
cls.wizard_vals = {
"company_id": cls.company.id,
"chart_template_id": cls.chart_template.id,
"code_digits": 6,
"lang": "en_US",
}
Loading

0 comments on commit 172e805

Please sign in to comment.