Skip to content

Commit dc514bf

Browse files
committed
[IMP] account_import_helper: re-write module
Full re-write of the module account_import_helper: it should now be used directly in the production DB and handles the deletion of existing accounts. Add in account_import_helper the wizard of the module account_ir_property_helper.
1 parent 960bff6 commit dc514bf

20 files changed

+535
-566
lines changed

account_import_helper/README.rst

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,51 +2,37 @@
22
Account Import Helper
33
=====================
44

5-
This module provides methods to help on the import of accounting-related data, in particular the chart of accounts.
5+
This module is designed to replace the standard chart of account of Odoo by the chart of accounts of the company before go-live.
66

7-
First, in a standard test Odoo database with the chart of account of the official addons, use the wizard available via the menu *Configuration > Technical > Chart Generate > Chart Generate* to generate the file *account.account.csv*.
7+
This module has been fully re-written on december 30th 2025 ; if you were used to the old procedure, please read carefully the new procedure below.
88

9-
Then, in the future production database, after the installation of the official addons that has the chart of accounts for the country:
9+
In the production database, install this module **account_import_helper** before go-live. As you are before go-live, there should be no journal items in the database.
1010

11-
* Unconfigure the links to the accounts from several objects and ir.properties:
11+
In developer mode, go to the menu **Settings > Technical > Tools for Chart of Accounts > Import Chart of Accounts** : it will start a wizard to import a custom chart of account from an XLSX file. The XLSX file should contain 2 columns with an optional third column:
1212

13-
.. code::
13+
- column A: the account code (required)
14+
- column B: the label of the account (required)
15+
- column C: some notes related to the account (optional)
1416

15-
UPDATE account_journal SET default_account_id=null, suspense_account_id=null WHERE company_id=X;
17+
When you run the import, Odoo will use the account code and label (and notes) from the XLSX file and the fields *Type*, *Allow Reconciliation* and *Non Trade* from the standard Odoo chart of accounts (you can choose between using the chart of account of the module *l10n_fr_account* or the OCA module *l10n_fr_account_oca*).
1618

17-
UPDATE FROM pos_payment_method SET outstanding_account_id=null, receivable_account_id=null WHERE company_id=X;
19+
If you select several companies in the *Companies* field of the wizard, Odoo will import the chart of accounts as shared accounts between those companies (new feature of Odoo 18).
1820

19-
UPDATE ir_default SET json_value = false FROM ir_model_fields f WHERE f.id = ir_default.field_id AND f.relation = 'account.account' AND ir_default.company_id = X
21+
Once the chart of account has been imported, check that the imported accounts are ok. Check that you have one and only one account with type *Current Year Earnings*.
2022

21-
DELETE FROM account_fiscal_position_account WHERE company_id=X;
23+
Go to the menu **Settings > Technical > Tools for Chart of Accounts > Re-configure after Chart of Account Import**: it starts a wizard that make it easy to re-configure the default accounts for partners and product categories, and also the suspense account for bank/cash journals and the transfer account of the company.
2224

23-
* Delete all accounts:
24-
25-
.. code::
26-
27-
DELETE FROM account_account_res_company_rel WHERE res_company_id=X
28-
29-
DELETE FROM account_account WHERE id in (SELECT a.id FROM account_account a LEFT JOIN account_account_res_company_rel rel ON rel.account_account_id = a.id WHERE rel.account_account_id IS NULL)
30-
31-
* In the menu *Invoicing > Configuration > Accounting > Chart of accounts*, import the file *account.account.csv* with *Encoding* set to **utf-8** and *Use first row as header* enabled.
25+
Eventually:
3226

3327
* In the menu *Invoicing > Configuration > Accounting > Taxes*, reconfigure the account on taxes.
3428

3529
* In the menu *Invoicing > Configuration > Accounting > Fiscal Positions*, on each fiscal position, configure the account mapping.
3630

3731
* In the menu *Invoicing > Configuration > Accounting > Journals*, on each journal, configure all the fields that point to accounts.
3832

39-
* On the page *Invoicing > Configuration > Settings*, update the section *Default Accounts*
40-
41-
* In the menu *Settings > Technical > Actions > User-defined Defaults*, edit the default having a 0 value including :
42-
43-
- Account Receivable
44-
- Account Payable
45-
- Expense Account
46-
- Income Account
47-
48-
and set the field *Default Value (JSON format)* with **67** where 67 is the ID of the account you want to have as default for that property.
33+
* On the page *Invoicing > Configuration > Settings*, update the section *Default Accounts*.
4934

35+
Once you have finished, you can uninstall the module **account_import_helper**.
5036

5137
Contributors
5238
============

account_import_helper/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
from . import models
2-
from . import wizard
1+
from . import wizards

account_import_helper/__manifest__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"external_dependencies": {"python": ["openpyxl"]},
1515
"data": [
1616
"security/ir.model.access.csv",
17-
"wizard/account_chart_generate_view.xml",
17+
"wizards/account_chart_import_view.xml",
18+
"wizards/account_chart_import_postprocess_view.xml",
1819
],
1920
"installable": True,
2021
}

account_import_helper/models/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

account_import_helper/models/res_company.py

Lines changed: 0 additions & 129 deletions
This file was deleted.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
2-
access_account_chart_generate_system,Full access on account.chart.generate,model_account_chart_generate,base.group_system,1,1,1,1
2+
access_account_chart_import_system,Full access on account.chart.import,model_account_chart_import,base.group_system,1,1,1,1
3+
access_account_chart_import_postprocess_system,Full access on account.chart.import.postprocess,model_account_chart_import_postprocess,base.group_system,1,1,1,1

account_import_helper/wizard/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

account_import_helper/wizard/account_chart_generate.py

Lines changed: 0 additions & 117 deletions
This file was deleted.

0 commit comments

Comments
 (0)