[MIG] account_chart_update: Migration to 12.0

This commit is contained in:
ernesto
2019-03-15 16:25:19 -04:00
committed by Reyes4711
parent da9893be5f
commit b6e2359d01
12 changed files with 98 additions and 90 deletions

View File

@@ -14,13 +14,13 @@ Detect changes and update the Account Chart from a template
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github
:target: https://github.com/OCA/account-financial-tools/tree/11.0/account_chart_update :target: https://github.com/OCA/account-financial-tools/tree/12.0/account_chart_update
:alt: OCA/account-financial-tools :alt: OCA/account-financial-tools
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-financial-tools-11-0/account-financial-tools-11-0-account_chart_update :target: https://translation.odoo-community.org/projects/account-financial-tools-12-0/account-financial-tools-12-0-account_chart_update
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/92/11.0 :target: https://runbot.odoo-community.org/runbot/92/12.0
:alt: Try me on Runbot :alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@@ -46,7 +46,7 @@ The wizard:
Usage Usage
===== =====
The wizard, accesible from *Accounting > Settings > Update chart of accounts*, The wizard, accesible from *Accounting > Settings > Update Chart Template*,
lets the user select what kind of objects must be checked/updated, and whether lets the user select what kind of objects must be checked/updated, and whether
old records must be checked for changes and updates. old records must be checked for changes and updates.
@@ -69,7 +69,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-financial-tools/issues>`_. Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-financial-tools/issues>`_.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_chart_update%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. `feedback <https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_chart_update%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues. Do not contact contributors directly about support or help with technical issues.
@@ -86,8 +86,12 @@ Authors
Contributors Contributors
~~~~~~~~~~~~ ~~~~~~~~~~~~
* Pedro M. Baeza <pedro.baeza@tecnativa.com> * `Tecnativa <https://www.tecnativa.com>`_:
* Jairo Llopis <jairo.llopis@tecnativa.com>
* Pedro M. Baeza
* Jairo Llopis
* Ernesto Tejeda
* Jacques-Etienne Baudoux <je@bcim.be> * Jacques-Etienne Baudoux <je@bcim.be>
* Sylvain Van Hoof <sylvain@okia.be> * Sylvain Van Hoof <sylvain@okia.be>
* Nacho Muñoz <nacmuro@gmail.com> * Nacho Muñoz <nacmuro@gmail.com>
@@ -106,6 +110,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
This module is part of the `OCA/account-financial-tools <https://github.com/OCA/account-financial-tools/tree/11.0/account_chart_update>`_ project on GitHub. This module is part of the `OCA/account-financial-tools <https://github.com/OCA/account-financial-tools/tree/12.0/account_chart_update>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com> # Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
# Copyright 2016 Jacques-Etienne Baudoux <je@bcim.be> # Copyright 2016 Jacques-Etienne Baudoux <je@bcim.be>
# Copyright 2016 Sylvain Van Hoof <sylvain@okia.be> # Copyright 2016 Sylvain Van Hoof <sylvain@okia.be>
@@ -6,21 +5,20 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{ {
'name': "Detect changes and update the Account Chart from a template", "name": "Detect changes and update the Account Chart from a template",
"summary": "Wizard to update a company's account chart from a template", "summary": "Wizard to update a company's account chart from a template",
'version': "11.0.2.1.0", "version": "12.0.1.0.0",
'author': "Tecnativa, " "author": "Tecnativa, "
"BCIM, " "BCIM, "
"Okia, " "Okia, "
"Odoo Community Association (OCA)", "Odoo Community Association (OCA)",
'website': "http://github.com/OCA/account-financial-tools", "website": "http://github.com/OCA/account-financial-tools",
'depends': ["account"], "depends": ["account"],
'development_status': 'Mature', "category": "Accounting",
'category': "Accounting", "license": "AGPL-3",
'license': "AGPL-3",
"data": [ "data": [
'wizard/wizard_chart_update_view.xml', "wizard/wizard_chart_update_view.xml",
'views/account_config_settings_view.xml', "views/account_config_settings_view.xml",
], ],
'installable': True, "installable": True,
} }

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import ir_model_fields from . import ir_model_fields

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Tecnativa - Pedro M. Baeza # Copyright 2018 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

View File

@@ -1,5 +1,9 @@
* Pedro M. Baeza <pedro.baeza@tecnativa.com> * `Tecnativa <https://www.tecnativa.com>`_:
* Jairo Llopis <jairo.llopis@tecnativa.com>
* Pedro M. Baeza
* Jairo Llopis
* Ernesto Tejeda
* Jacques-Etienne Baudoux <je@bcim.be> * Jacques-Etienne Baudoux <je@bcim.be>
* Sylvain Van Hoof <sylvain@okia.be> * Sylvain Van Hoof <sylvain@okia.be>
* Nacho Muñoz <nacmuro@gmail.com> * Nacho Muñoz <nacmuro@gmail.com>

View File

@@ -1,4 +1,4 @@
The wizard, accesible from *Accounting > Settings > Update chart of accounts*, The wizard, accesible from *Accounting > Settings > Update Chart Template*,
lets the user select what kind of objects must be checked/updated, and whether lets the user select what kind of objects must be checked/updated, and whether
old records must be checked for changes and updates. old records must be checked for changes and updates.

View File

@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.png" /></a> <a class="reference external" 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" href="https://github.com/OCA/account-financial-tools/tree/11.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" href="https://translation.odoo-community.org/projects/account-financial-tools-11-0/account-financial-tools-11-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" href="https://runbot.odoo-community.org/runbot/92/11.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> <p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.png" /></a> <a class="reference external" 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" href="https://github.com/OCA/account-financial-tools/tree/12.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" href="https://translation.odoo-community.org/projects/account-financial-tools-12-0/account-financial-tools-12-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" href="https://runbot.odoo-community.org/runbot/92/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This is a pretty useful tool to update Odoo installations after tax reforms <p>This is a pretty useful tool to update Odoo installations after tax reforms
on the official charts of accounts, or to apply fixes performed on the chart on the official charts of accounts, or to apply fixes performed on the chart
template.</p> template.</p>
@@ -396,7 +396,7 @@ positions that got modified on the template.</li>
</div> </div>
<div class="section" id="usage"> <div class="section" id="usage">
<h1><a class="toc-backref" href="#id1">Usage</a></h1> <h1><a class="toc-backref" href="#id1">Usage</a></h1>
<p>The wizard, accesible from <em>Accounting &gt; Settings &gt; Update chart of accounts</em>, <p>The wizard, accesible from <em>Accounting &gt; Settings &gt; Update Chart Template</em>,
lets the user select what kind of objects must be checked/updated, and whether lets the user select what kind of objects must be checked/updated, and whether
old records must be checked for changes and updates.</p> old records must be checked for changes and updates.</p>
<p>It will display all the objects to be created / updated / deactivated with some <p>It will display all the objects to be created / updated / deactivated with some
@@ -418,7 +418,7 @@ deactivate).</li>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-financial-tools/issues">GitHub Issues</a>. <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-financial-tools/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_chart_update%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <a class="reference external" href="https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_chart_update%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
@@ -434,8 +434,12 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<div class="section" id="contributors"> <div class="section" id="contributors">
<h2><a class="toc-backref" href="#id6">Contributors</a></h2> <h2><a class="toc-backref" href="#id6">Contributors</a></h2>
<ul class="simple"> <ul class="simple">
<li>Pedro M. Baeza &lt;<a class="reference external" href="mailto:pedro.baeza&#64;tecnativa.com">pedro.baeza&#64;tecnativa.com</a>&gt;</li> <li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Jairo Llopis &lt;<a class="reference external" href="mailto:jairo.llopis&#64;tecnativa.com">jairo.llopis&#64;tecnativa.com</a>&gt;</li> <li>Pedro M. Baeza</li>
<li>Jairo Llopis</li>
<li>Ernesto Tejeda</li>
</ul>
</li>
<li>Jacques-Etienne Baudoux &lt;<a class="reference external" href="mailto:je&#64;bcim.be">je&#64;bcim.be</a>&gt;</li> <li>Jacques-Etienne Baudoux &lt;<a class="reference external" href="mailto:je&#64;bcim.be">je&#64;bcim.be</a>&gt;</li>
<li>Sylvain Van Hoof &lt;<a class="reference external" href="mailto:sylvain&#64;okia.be">sylvain&#64;okia.be</a>&gt;</li> <li>Sylvain Van Hoof &lt;<a class="reference external" href="mailto:sylvain&#64;okia.be">sylvain&#64;okia.be</a>&gt;</li>
<li>Nacho Muñoz &lt;<a class="reference external" href="mailto:nacmuro&#64;gmail.com">nacmuro&#64;gmail.com</a>&gt;</li> <li>Nacho Muñoz &lt;<a class="reference external" href="mailto:nacmuro&#64;gmail.com">nacmuro&#64;gmail.com</a>&gt;</li>
@@ -449,7 +453,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-financial-tools/tree/11.0/account_chart_update">OCA/account-financial-tools</a> project on GitHub.</p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-financial-tools/tree/12.0/account_chart_update">OCA/account-financial-tools</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div> </div>
</div> </div>

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import test_account_chart_update from . import test_account_chart_update

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields from odoo import fields
@@ -67,6 +66,9 @@ class TestAccountChartUpdate(common.HttpCase):
'currency_id': self.env.ref('base.EUR').id, 'currency_id': self.env.ref('base.EUR').id,
'code_digits': 6, 'code_digits': 6,
'transfer_account_id': self.account_template.id, 'transfer_account_id': self.account_template.id,
'cash_account_code_prefix': '570',
'bank_account_code_prefix': '572',
'transfer_account_code_prefix': '100000',
}) })
self.account_template.chart_template_id = self.chart_template.id self.account_template.chart_template_id = self.chart_template.id
self.account_template_pl = self._create_account_tmpl( self.account_template_pl = self._create_account_tmpl(
@@ -106,18 +108,10 @@ class TestAccountChartUpdate(common.HttpCase):
'name': 'Test account_chart_update company', 'name': 'Test account_chart_update company',
'currency_id': self.chart_template.currency_id.id, 'currency_id': self.chart_template.currency_id.id,
}) })
# Load chart of template into company company_user = self.env.user.copy({'company_id': self.company.id})
wizard = self.env['wizard.multi.charts.accounts'].create({ chart_by_company_user = self.chart_template.sudo(company_user)
'company_id': self.company.id, chart_by_company_user.try_loading_for_current_company()
'chart_template_id': self.chart_template.id,
'code_digits': self.chart_template.code_digits,
'transfer_account_id': self.account_template.id,
'currency_id': self.chart_template.currency_id.id,
'bank_account_code_prefix': '572',
'cash_account_code_prefix': '570',
})
wizard.onchange_chart_template_id()
wizard.execute()
self.tax = self.env['account.tax'].search([ self.tax = self.env['account.tax'].search([
('name', '=', self.tax_template.name), ('name', '=', self.tax_template.name),
('company_id', '=', self.company.id), ('company_id', '=', self.company.id),
@@ -310,7 +304,7 @@ class TestAccountChartUpdate(common.HttpCase):
self.assertFalse(new_tax.active) self.assertFalse(new_tax.active)
wizard.unlink() wizard.unlink()
# Errors on account update # Errors on account update
self.account_template.reconcile = True self.account_template.currency_id = self.ref('base.USD')
self.env['account.move'].create({ self.env['account.move'].create({
'name': 'Test move', 'name': 'Test move',
'journal_id': self.env['account.journal'].search([ 'journal_id': self.env['account.journal'].search([
@@ -323,6 +317,7 @@ class TestAccountChartUpdate(common.HttpCase):
'name': 'Test move line', 'name': 'Test move line',
'debit': 10, 'debit': 10,
'credit': 0, 'credit': 0,
'currency_id': self.ref('base.EUR'),
}), }),
(0, 0, { (0, 0, {
'account_id': self.account.id, 'account_id': self.account.id,
@@ -340,13 +335,13 @@ class TestAccountChartUpdate(common.HttpCase):
# Errors on account update - continuing after that # Errors on account update - continuing after that
wizard.continue_on_errors = True wizard.continue_on_errors = True
wizard.action_update_records() wizard.action_update_records()
self.assertFalse(self.account.reconcile) self.assertFalse(self.account.currency_id)
self.assertEqual(self.tax.description, self.tax_template.description) self.assertEqual(self.tax.description, self.tax_template.description)
self.assertEqual(wizard.rejected_updated_account_number, 1) self.assertEqual(wizard.rejected_updated_account_number, 1)
self.assertEqual(wizard.updated_accounts, 0) self.assertEqual(wizard.updated_accounts, 0)
wizard.unlink() wizard.unlink()
# Errors on account_creation # Errors on account_creation
self.account_template.reconcile = False self.account_template.currency_id = False
new_account_tmpl_2 = self._create_account_tmpl( new_account_tmpl_2 = self._create_account_tmpl(
'Test account 3', '444444', self.account_type, self.chart_template, 'Test account 3', '444444', self.account_type, self.chart_template,
) )

View File

@@ -1,21 +1,19 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- © 2016 Jairo Llopis <jairo.llopis@tecnativa.com> <!-- Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo> <odoo>
<record id="res_config_settings_view_form" model="ir.ui.view">
<record id="view_res_config_settings" model="ir.ui.view"> <field name="name">Open Account Chart Update Wizard 2</field>
<field name="name">Open Account Chart Update Wizard</field>
<field name="model">res.config.settings</field> <field name="model">res.config.settings</field>
<field name="inherit_id" ref="account.res_config_settings_view_form"/> <field name="inherit_id" ref="account.res_config_settings_view_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<div data-key="account" position="inside">
<div data-key="account_invoicing" position="inside">
<h2>Update Chart Template</h2> <h2>Update Chart Template</h2>
<div class="row mt16 o_settings_container"> <div class="row mt16 o_settings_container">
<div class="col-xs-12 col-md-6 o_setting_box"> <div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_left_pane"/> <div class="o_setting_left_pane"/>
<div class="o_setting_right_pane"> <div class="o_setting_right_pane">
<label string="Update Chart Template"/> <span class="o_form_label">Update Chart Template</span>
<div class="text-muted"> <div class="text-muted">
Update Taxes, fiscal positions or chart of accounts. Update Taxes, fiscal positions or chart of accounts.
</div> </div>

View File

@@ -1,10 +1,10 @@
# © 2010 Jordi Esteve, Zikzakmedia S.L. (http://www.zikzakmedia.com) # Copyright 2010 Jordi Esteve, Zikzakmedia S.L. (http://www.zikzakmedia.com)
# © 2010 Pexego Sistemas Informáticos S.L.(http://www.pexego.es) # Copyright 2010 Pexego Sistemas Informáticos S.L.(http://www.pexego.es)
# Borja López Soilán # Borja López Soilán
# © 2013 Joaquin Gutierrez (http://www.gutierrezweb.es) # Copyright 2013 Joaquin Gutierrez (http://www.gutierrezweb.es)
# © 2015 Antonio Espinosa <antonioea@tecnativa.com> # Copyright 2015 Antonio Espinosa <antonioea@tecnativa.com>
# © 2016 Jairo Llopis <jairo.llopis@tecnativa.com> # Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
# © 2016 Jacques-Etienne Baudoux <je@bcim.be> # Copyright 2016 Jacques-Etienne Baudoux <je@bcim.be>
# Copyright 2018 Tecnativa - Pedro M. Baeza # Copyright 2018 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
@@ -20,6 +20,7 @@ EXCEPTION_TEXT = "Traceback (most recent call last)"
class WizardUpdateChartsAccounts(models.TransientModel): class WizardUpdateChartsAccounts(models.TransientModel):
_name = 'wizard.update.charts.accounts' _name = 'wizard.update.charts.accounts'
_description = 'Wizard Update Charts Accounts'
state = fields.Selection( state = fields.Selection(
selection=[('init', 'Configuration'), selection=[('init', 'Configuration'),
@@ -38,9 +39,7 @@ class WizardUpdateChartsAccounts(models.TransientModel):
compute="_compute_chart_template_ids", compute="_compute_chart_template_ids",
help="Includes all chart templates.") help="Includes all chart templates.")
code_digits = fields.Integer( code_digits = fields.Integer(
string='# of digits', required=True, related="chart_template_id.code_digits")
help="No. of digits to use for account code. "
"Make sure it is the same number as existing accounts.")
lang = fields.Selection( lang = fields.Selection(
lambda self: self._get_lang_selection_options(), 'Language', size=5, lambda self: self._get_lang_selection_options(), 'Language', size=5,
required=True, required=True,
@@ -129,13 +128,13 @@ class WizardUpdateChartsAccounts(models.TransientModel):
account_matching_ids = fields.One2many( account_matching_ids = fields.One2many(
comodel_name="wizard.account.matching", comodel_name="wizard.account.matching",
inverse_name="update_chart_wizard_id", inverse_name="update_chart_wizard_id",
string="Taxes matching", string="Accounts matching",
default=lambda self: self._default_account_matching_ids(), default=lambda self: self._default_account_matching_ids(),
) )
fp_matching_ids = fields.One2many( fp_matching_ids = fields.One2many(
comodel_name="wizard.fp.matching", comodel_name="wizard.fp.matching",
inverse_name="update_chart_wizard_id", inverse_name="update_chart_wizard_id",
string="Taxes matching", string="Fiscal positions matching",
default=lambda self: self._default_fp_matching_ids(), default=lambda self: self._default_fp_matching_ids(),
) )
@@ -204,9 +203,8 @@ class WizardUpdateChartsAccounts(models.TransientModel):
@api.multi @api.multi
@api.depends("chart_template_id") @api.depends("chart_template_id")
def _compute_chart_template_ids(self): def _compute_chart_template_ids(self):
self.chart_template_ids = ( all_parents = self.chart_template_id._get_chart_parent_ids()
self.env['wizard.multi.charts.accounts'] self.chart_template_ids = all_parents
._get_chart_parent_ids(self.chart_template_id))
@api.multi @api.multi
@api.depends('tax_ids') @api.depends('tax_ids')
@@ -256,20 +254,6 @@ class WizardUpdateChartsAccounts(models.TransientModel):
def _onchage_company_update_chart_template(self): def _onchage_company_update_chart_template(self):
self.chart_template_id = self.company_id.chart_template_id self.chart_template_id = self.company_id.chart_template_id
@api.model
def _get_code_digits(self, company=None):
"""Returns the number of digits for the accounts, fetched from
the company.
"""
if company is None:
company = self.env.user.company_id
return company.accounts_code_digits or 6
@api.onchange('company_id')
def onchange_company_id(self):
"""Update the code digits when the company changes"""
self.code_digits = self._get_code_digits(company=self.company_id)
@api.multi @api.multi
def _reopen(self): def _reopen(self):
return { return {
@@ -1030,6 +1014,7 @@ class WizardUpdateChartsAccountsFiscalPosition(models.TransientModel):
class WizardMatching(models.TransientModel): class WizardMatching(models.TransientModel):
_name = 'wizard.matching' _name = 'wizard.matching'
_description = 'Wizard Matching'
_order = 'sequence' _order = 'sequence'
update_chart_wizard_id = fields.Many2one( update_chart_wizard_id = fields.Many2one(

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- © 2016 Jairo Llopis <jairo.llopis@tecnativa.com> <!-- Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo> <odoo>
@@ -18,7 +18,13 @@
</header> </header>
<group attrs="{'invisible':[('state','!=','init')]}"> <group attrs="{'invisible':[('state','!=','init')]}">
<h3> <h3>
<p><center>This wizard will update your accounts, taxes and fiscal positions according to the selected chart template</center></p> <p>
<center>
This wizard will update your accounts, taxes and
fiscal positions according to the selected chart
template
</center>
</p>
</h3> </h3>
</group> </group>
<group string="Chart of Accounts" attrs="{'invisible':[('state','!=','init')]}"> <group string="Chart of Accounts" attrs="{'invisible':[('state','!=','init')]}">
@@ -47,16 +53,29 @@
</group> </group>
<group> <group>
<h5> <h5>
<p>If you leave these options set, the wizard will not just create new records, but also update records with changes (i.e. different tax amount)</p> <p>
<p>Note: Only the changed fields are updated.</p> If you leave these options set, the wizard will
not just create new records, but also update
records with changes (i.e. different tax amount)
</p>
<p>
Note: Only the changed fields are updated.
</p>
</h5> </h5>
</group> </group>
</page> </page>
<page string="Field options" <page string="Field options"
attrs="{'invisible': [('update_tax', '=', False), ('update_account', '=', False), ('update_fiscal_position', '=', False)]}" attrs="{'invisible': [
('update_tax', '=', False),
('update_account', '=', False),
('update_fiscal_position', '=', False),
]}"
> >
<h3> <h3>
<p>Here you can select the fields you want to check if they have been updated in the templates.</p> <p>
Here you can select the fields you want to check if
they have been updated in the templates.
</p>
</h3> </h3>
<notebook> <notebook>
<page string="Taxes" <page string="Taxes"
@@ -89,7 +108,11 @@
</notebook> </notebook>
</page> </page>
<page string="Matching" <page string="Matching"
attrs="{'invisible': [('update_tax', '=', False), ('update_account', '=', False), ('update_fiscal_position', '=', False)]}" attrs="{'invisible': [
('update_tax', '=', False),
('update_account', '=', False),
('update_fiscal_position', '=', False),
]}"
> >
<h3> <h3>
<p>Here you can set the matching order.</p> <p>Here you can set the matching order.</p>