[14.0][MIG] account_chart_update: Migration to 14.0

This commit is contained in:
Reyes4711
2021-03-08 17:25:04 +01:00
parent c726257307
commit df635240be
5 changed files with 89 additions and 11 deletions

View File

@@ -7,13 +7,14 @@
{
"name": "Detect changes and update the Account Chart from a template",
"summary": "Wizard to update a company's account chart from a template",
"version": "13.0.1.0.5",
"version": "14.0.1.0.0",
"author": "Tecnativa, BCIM, Okia, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-financial-tools",
"depends": ["account"],
"category": "Accounting",
"license": "AGPL-3",
"data": [
"security/ir.model.access.csv",
"wizard/wizard_chart_update_view.xml",
"views/account_config_settings_view.xml",
],

View File

@@ -0,0 +1,9 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_wizard_update_charts_accounts,wizard.update.charts.accounts,model_wizard_update_charts_accounts,,1,1,1,1
access_wizard_update_charts_accounts_account,wizard.update.charts.accounts.account,model_wizard_update_charts_accounts_account,,1,1,1,1
access_wizard_tax_matching,wizard.tax.matching,model_wizard_tax_matching,,1,1,1,1
access_wizard_fp_matching,wizard.fp.matching,model_wizard_fp_matching,,1,1,1,1
access_wizard_account_matching,wizard.account.matching,model_wizard_account_matching,,1,1,1,1
access_wizard_update_charts_accounts_tax,wizard.update.charts.accounts.tax,model_wizard_update_charts_accounts_tax,,1,1,1,1
access_wizard_matching,wizard.matching,model_wizard_matching,,1,1,1,1
access_wizard_update_charts_accounts_fiscal_position,wizard.update.charts.accounts.fiscal.position,model_wizard_update_charts_accounts_fiscal_position,,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_wizard_update_charts_accounts wizard.update.charts.accounts model_wizard_update_charts_accounts 1 1 1 1
3 access_wizard_update_charts_accounts_account wizard.update.charts.accounts.account model_wizard_update_charts_accounts_account 1 1 1 1
4 access_wizard_tax_matching wizard.tax.matching model_wizard_tax_matching 1 1 1 1
5 access_wizard_fp_matching wizard.fp.matching model_wizard_fp_matching 1 1 1 1
6 access_wizard_account_matching wizard.account.matching model_wizard_account_matching 1 1 1 1
7 access_wizard_update_charts_accounts_tax wizard.update.charts.accounts.tax model_wizard_update_charts_accounts_tax 1 1 1 1
8 access_wizard_matching wizard.matching model_wizard_matching 1 1 1 1
9 access_wizard_update_charts_accounts_fiscal_position wizard.update.charts.accounts.fiscal.position model_wizard_update_charts_accounts_fiscal_position 1 1 1 1

View File

@@ -126,7 +126,7 @@ class TestAccountChartUpdate(common.HttpCase):
)
company_user = self.env.user.copy({"company_id": self.company.id})
chart_by_company_user = self.chart_template.with_user(company_user)
chart_by_company_user.try_loading_for_current_company()
chart_by_company_user.try_loading()
self.tax = self.env["account.tax"].search(
[
@@ -324,7 +324,7 @@ class TestAccountChartUpdate(common.HttpCase):
self.env["account.move"].create(
{
"name": "Test move",
"type": "entry",
"move_type": "entry",
"journal_id": self.env["account.journal"]
.search([("company_id", "=", self.company.id)], limit=1)
.id,

View File

@@ -55,7 +55,6 @@ class WizardUpdateChartsAccounts(models.TransientModel):
lang = fields.Selection(
lambda self: self._get_lang_selection_options(),
"Language",
size=5,
required=True,
help="For records searched by name (taxes, fiscal "
"positions), the template name will be matched against the "
@@ -87,7 +86,6 @@ class WizardUpdateChartsAccounts(models.TransientModel):
recreate_xml_ids = fields.Boolean(string="Recreate missing XML-IDs")
tax_ids = fields.One2many(
comodel_name="wizard.update.charts.accounts.tax",
ondelete="cascade",
inverse_name="update_chart_wizard_id",
string="Taxes",
)
@@ -95,13 +93,11 @@ class WizardUpdateChartsAccounts(models.TransientModel):
comodel_name="wizard.update.charts.accounts.account",
inverse_name="update_chart_wizard_id",
string="Accounts",
ondelete="cascade",
)
fiscal_position_ids = fields.One2many(
comodel_name="wizard.update.charts.accounts.fiscal.position",
inverse_name="update_chart_wizard_id",
string="Fiscal positions",
ondelete="cascade",
)
new_taxes = fields.Integer(string="New taxes", compute="_compute_new_taxes_count")
new_accounts = fields.Integer(
@@ -1101,7 +1097,7 @@ class WizardUpdateChartsAccountsTax(models.TransientModel):
("deleted", "Tax to deactivate"),
],
string="Type",
readonly=True,
readonly=False,
)
type_tax_use = fields.Selection(related="tax_id.type_tax_use", readonly=True)
update_tax_id = fields.Many2one(
@@ -1111,6 +1107,10 @@ class WizardUpdateChartsAccountsTax(models.TransientModel):
ondelete="set null",
)
notes = fields.Text("Notes", readonly=True)
recreate_xml_ids = fields.Boolean(
string="Recreate missing XML-IDs",
related="update_chart_wizard_id.recreate_xml_ids",
)
class WizardUpdateChartsAccountsAccount(models.TransientModel):
@@ -1133,7 +1133,7 @@ class WizardUpdateChartsAccountsAccount(models.TransientModel):
type = fields.Selection(
selection=[("new", "New template"), ("updated", "Updated template")],
string="Type",
readonly=True,
readonly=False,
)
update_account_id = fields.Many2one(
comodel_name="account.account",
@@ -1142,6 +1142,10 @@ class WizardUpdateChartsAccountsAccount(models.TransientModel):
ondelete="set null",
)
notes = fields.Text("Notes", readonly=True)
recreate_xml_ids = fields.Boolean(
string="Recreate missing XML-IDs",
related="update_chart_wizard_id.recreate_xml_ids",
)
class WizardUpdateChartsAccountsFiscalPosition(models.TransientModel):
@@ -1164,8 +1168,7 @@ class WizardUpdateChartsAccountsFiscalPosition(models.TransientModel):
type = fields.Selection(
selection=[("new", "New template"), ("updated", "Updated template")],
string="Type",
readonly=True,
required=True,
readonly=False,
)
update_fiscal_position_id = fields.Many2one(
comodel_name="account.fiscal.position",
@@ -1174,6 +1177,10 @@ class WizardUpdateChartsAccountsFiscalPosition(models.TransientModel):
ondelete="set null",
)
notes = fields.Text("Notes", readonly=True)
recreate_xml_ids = fields.Boolean(
string="Recreate missing XML-IDs",
related="update_chart_wizard_id.recreate_xml_ids",
)
class WizardMatching(models.TransientModel):

View File

@@ -211,6 +211,27 @@
<field name="notes" />
<field name="type" />
</tree>
<form>
<group col="2">
<group>
<field
name="recreate_xml_ids"
invisible="1"
/>
<field name="tax_id" />
<field
name="type"
attrs="{'readonly': [('recreate_xml_ids','=', False)]}"
/>
<field name="notes" />
</group>
<group>
<field name="update_chart_wizard_id" />
<field name="type_tax_use" />
<field name="update_tax_id" />
</group>
</group>
</form>
</field>
</page>
<page
@@ -224,6 +245,26 @@
<field name="notes" />
<field name="type" />
</tree>
<form>
<group col="2">
<group>
<field
name="recreate_xml_ids"
invisible="1"
/>
<field name="account_id" />
<field
name="type"
attrs="{'readonly': [('recreate_xml_ids','=', False)]}"
/>
<field name="notes" />
</group>
<group>
<field name="update_chart_wizard_id" />
<field name="update_account_id" />
</group>
</group>
</form>
</field>
</page>
<page
@@ -240,6 +281,26 @@
<field name="notes" />
<field name="type" />
</tree>
<form>
<group col="2">
<group>
<field
name="recreate_xml_ids"
invisible="1"
/>
<field name="fiscal_position_id" />
<field
name="type"
attrs="{'readonly': [('recreate_xml_ids','=', False)]}"
/>
<field name="notes" />
</group>
<group>
<field name="update_chart_wizard_id" />
<field name="update_fiscal_position_id" />
</group>
</group>
</form>
</field>
</page>
</notebook>