会计本地化¶
警告
This tutorial requires knowledge about how to build a module in Odoo (see Server framework 101).
安装过程¶
On installing the account module, the localization module corresponding to the country code of the company is installed automatically. In case of no country code set or no localization module found, the l10n_generic_coa (US) localization module is installed by default. Check post init hook for details.
For example, l10n_ch will be installed if the company has Switzerland
as country.
构建本地化模块¶
一个基本的 l10n_XX
模块的结构可以用下面的 __manifest__.py
文件来描述:
{
"name": "COUNTRY - Accounting",
"version": "1.0.0",
"category": "Accounting/Localizations/Account Charts",
"license": "LGPL-3",
"depends": [
"account",
],
"data": [
"data/other_data.xml",
"views/xxxmodel_views.xml",
],
"demo": [
"demo/demo_company.xml",
]
}
Your worktree should look like this
l10n_xx
├── data
│ ├── template
│ │ ├── account.account-xx.csv
│ │ ├── account.group-xx.csv
│ │ └── account.tax.group-xx.csv
│ └── other_data.xml
├── views
│ └── xxxmodel_views.xml
├── demo
│ └── demo_company.xml
├── models
│ ├── template_xx.py
│ └── __init__.py
├── __init__.py
└── __manifest__.py
In the first file models/template_xx.py
, we set the name for the chart of accounts along with some basic fields.
Example
addons/l10n_be/models/template_be.py
def _get_be_template_data(self):
return {
'name': _('Base'),
'visible': False,
'code_digits': '6',
'property_account_receivable_id': 'a400',
'property_account_payable_id': 'a440',
'property_account_expense_categ_id': 'a600',
'property_account_income_categ_id': 'a7000',
}
@template('be', 'res.company')
def _get_be_res_company(self):
return {
self.env.company.id: {
'account_fiscal_country_id': 'base.be',
'bank_account_code_prefix': '550',
'cash_account_code_prefix': '570',
'transfer_account_code_prefix': '580',
'account_default_pos_receivable_account_id': 'a4001',
'income_currency_exchange_account_id': 'a754',
'expense_currency_exchange_account_id': 'a654',
'account_journal_suspense_account_id': 'a499',
'account_journal_early_pay_discount_loss_account_id': 'a657000',
'account_journal_early_pay_discount_gain_account_id': 'a757000',
'account_sale_tax_id': 'attn_VAT-OUT-21-L',
'account_purchase_tax_id': 'attn_VAT-IN-V81-21',
'default_cash_difference_income_account_id': 'a757100',
'default_cash_difference_expense_account_id': 'a657100',
'transfer_account_id': 'a58',
},
}
@template('be', 'account.journal')
def _get_be_account_journal(self):
return {
'sale': {'refund_sequence': True},
'purchase': {'refund_sequence': True},
}
@template('be', 'account.reconcile.model')
科目表¶
账户¶
另请参阅
显然, 科目表 不能没有 账户 。你需要在 data/account.account.template.csv
中指定它们。
Example
addons/l10n_ch/data/template/account.account-ch.csv
"id","name","code","account_type","reconcile","name@de","name@it","name@fr","name@ar","name@zh_CN","name@nl"
"ch_coa_1060","Securities (with stock exchange price)","1060","asset_current","False","Wertpapiere (mit Börsenkurs)","Titoli","Titres","","",""
"ch_coa_1069","Accumulated depreciation on securities","1069","asset_current","False","Kumulierte Abschreibungen auf Wertpapiere","Rettifica valore titoli","Ajustement de la valeur des titres","","",""
"ch_coa_1091","Transfer account: Salaries","1091","asset_current","True","Transferkonto: Gehälter","Conto d'attesa - Salari","Compte d'attente pour salaires","","",""
"ch_coa_1099","Transfer account: miscellaneous","1099","asset_current","True","Transferkonto: Verschiedenes","Conto d'attesa - altro","Compte d'attente autre","","",""
"ch_coa_1100","Accounts receivable from goods and services (Debtors)","1100","asset_receivable","True","Forderungen aus Lieferungen und Leistungen (Debitoren)","Crediti da forniture e prestazioni (debitori)","Débiteurs","","",""
"ch_coa_1101","Receivable (PoS)","1101","asset_receivable","True","Forderungen (PoS)","Crediti (Punti Vendita)","Débiteurs (PoS)","","",""
"ch_coa_1109","Del credere (Acc. depr. on debtors)","1109","asset_current","False","Delkredere (Akontoabzug für Schuldner)","Delcredere","Ducroire","","",""
"ch_coa_1140","Advances and loans","1140","asset_current","False","Vorschüsse und Darlehen","Anticipi e prestiti","Avances et prêts","","",""
"ch_coa_1149","Advances and loans adjustments","1149","asset_current","False","Anpassungen von Vorschüssen und Darlehen","Rettifica valore anticipi e prestiti","Ajustement de la valeur des avances et des prêts","","",""
"ch_coa_1170","Input Tax (VAT) receivable on material, goods, services, energy","1170","asset_current","False","Vorsteuer (MwSt.) auf Material, Waren, Dienstleistungen, Energie","IVA, Imposta precedente su materiale, merce, servizi e energia","Impôt préalable: TVA s/matériel, marchandises, prestations et énergie","","",""
"ch_coa_1171","Input Tax (VAT) receivable on investments, other operating expenses","1171","asset_current","False","Vorsteuer (MwSt.) auf Investitionen, sonstige betriebliche Aufwendungen","IVA, imposta precedente su investimenti e altri costi d’esercizio","Impôt préalable: TVA s/investissements et autres charges d’exploitation","","",""
警告
Avoid the usage of
asset_cash
account_type
! Indeed, the bank & cash accounts are created directly at the installation of the localization module and then, are linked to anaccount.journal
.一般情况下,只需要一个应付/应收账户。但是我们还需要定义一个点 of Sale 应收账户(在 CoA 中链接)。
不要创建太多账户:200-300个足够了。但是,我们主要是要找到一个良好的平衡点,使大多数公司在之后使用时,会对会计科目表进行最小限度的调整。
账户组¶
账户组允许描述账户表的分层结构。需要在报告中激活过滤器,然后当您展开成日志条目时,它将显示账户的父级。
It works with the prefix start/end, so every account where the code starts with something between start and end will have this account.group
as the parent group. Furthermore, the account groups can have a parent account group as well to form the hierarchy.
Example
addons/l10n_il/data/template/account.group-il.csv
编号 |
code_prefix_start |
code_prefix_end |
名称 |
|
---|---|---|---|---|
il_group_100100 |
100100 |
100499 |
Fixed Assets |
רכוש קבוע |
il_group_101110 |
101110 |
101400 |
Current Assets |
רכוש שוטף |
il_group_101401 |
101401 |
101799 |
Bank And Cash |
בנק ומזומנים |
il_group_111000 |
111000 |
111999 |
Current Liabilities |
התחייבויות שוטפות |
il_group_112000 |
112000 |
112210 |
Non-current Liabilities |
התחייבויות לא שוטפות |
il_group_200000 |
200000 |
200199 |
Sales Income |
הכנסות ממכירות |
il_group_200200 |
200200 |
200300 |
Other Income |
הכנסות אחרות |
il_group_201000 |
201000 |
201299 |
Cost of Goods |
עלות המכר |
il_group_202000 |
202000 |
220900 |
Expenses |
הוצאות |
il_group_300000 |
300000 |
399999 |
Capital And Shares |
הון ומניות |
税费¶
另请参阅
To add taxes you first need to specify tax groups. You normally need just one tax group for every tax rate, except for the 0% as you need to often distinguish between exempt, 0%, not subject, … taxes.
This model only has two required fields: name
and country
. Create the file data/template/account.tax.group-xx.csv
and list the groups.
Example
addons/l10n_uk/data/template/account.tax.group-uk.csv
"id","name","country_id","tax_payable_account_id","tax_receivable_account_id"
"tax_group_0","TAX 0%","base.uk","2202","2202"
"tax_group_5","TAX 5%","base.uk","2202","2202"
"tax_group_175","TAX 17.5%","base.uk","2202","2202"
"tax_group_20","TAX 20%","base.uk","2202","2202"
Now you can add the taxes via data/template/account.tax-xx.csv
file. The first tax you define that is purchase/sale also becomes the default purchase/sale tax for your products.
Example
addons/l10n_ae/data/template/account.tax-ae.csv
"id","name","type_tax_use","amount","amount_type","description","invoice_label","tax_group_id","repartition_line_ids/repartition_type","repartition_line_ids/document_type","repartition_line_ids/tag_ids","repartition_line_ids/account_id","repartition_line_ids/factor_percent"
"uae_sale_tax_5_dubai","5% DB","sale","5.0","percent","Vat 5% Dubai","VAT 5%","ae_tax_group_5","base","invoice","+b. Dubai (Base)","",""
"","","","","","","","","tax","invoice","+b. Dubai (Tax)","uae_account_201017",""
"","","","","","","","","base","refund","-b. Dubai (Base)","",""
"","","","","","","","","tax","refund","-b. Dubai (Tax)","uae_account_201017",""
"uae_sale_tax_5_abu_dhabi","5% AD","sale","5.0","percent","VAT 5% Abu Dhabi","VAT 5%","ae_tax_group_5","base","invoice","+a. Abu Dhabi (Base)","",""
"","","","","","","","","tax","invoice","+a. Abu Dhabi (Tax)","uae_account_201017",""
"","","","","","","","","base","refund","-a. Abu Dhabi (Base)","",""
"","","","","","","","","tax","refund","-a. Abu Dhabi (Tax)","uae_account_201017",""
"uae_sale_tax_5_sharjah","5% S","sale","5.0","percent","VAT 5% Sharjah","VAT 5%","ae_tax_group_5","base","invoice","+c. Sharjah (Base)","",""
"","","","","","","","","tax","invoice","+c. Sharjah (Tax)","uae_account_201017",""
"","","","","","","","","base","refund","-c. Sharjah (Base)","",""
"","","","","","","","","tax","refund","-c. Sharjah (Tax)","uae_account_201017",""
"uae_sale_tax_5_ajman","5% A","sale","5.0","percent","VAT 5% Ajman","VAT 5%","ae_tax_group_5","base","invoice","+d. Ajman (Base)","",""
"","","","","","","","","tax","invoice","+d. Ajman (Tax)","uae_account_201017",""
"","","","","","","","","base","refund","-d. Ajman (Base)","",""
"","","","","","","","","tax","refund","-d. Ajman (Tax)","uae_account_201017",""
"uae_sale_tax_5_umm_al_quwain","5% UAQ","sale","5.0","percent","VAT 5% Umm Al Quwain","VAT 5%","ae_tax_group_5","base","invoice","+e. Umm Al Quwain (Base)","",""
"","","","","","","","","tax","invoice","+e. Umm Al Quwain (Tax)","uae_account_201017",""
"","","","","","","","","base","refund","-e. Umm Al Quwain (Base)","",""
"","","","","","","","","tax","refund","-e. Umm Al Quwain (Tax)","uae_account_201017",""
"uae_sale_tax_5_ras_al_khaima","5% RAK","sale","5.0","percent","VAT 5% Ras Al-Khaima","VAT 5%","ae_tax_group_5","base","invoice","+f. Ras Al-Khaima (Base)","",""
税务报告¶
税务报告在 发票 (account
) 应用程序中声明,但是只有在安装了 会计 (account_accountant
) 后才能访问该报告。
另请参阅
在前一节中,您注意到了字段 invoice_repartition_line_ids
或 refund_repartition_line_ids
,可能对它们一无所知。好消息是:您并不孤单,对此一无所知。坏消息是:您必须自己弄明白一点。这个主题很复杂。确实:
accounting_localization/tax_report.dot > Graph not rendered because `dot` is not installed
简单来说,在税务模板中,您可以在发票/退款分配行中指示税金的基数或百分比应该报告在哪个报告行中(通过 minus/plus_report_line_ids 字段)。当您在Odoo界面中检查税务配置时(或查看文档 Tax References , Tax Repartition References ),这也变得清晰明了。
So, once you have properly configured taxes, you just need to add the data/account_tax_report_data.xml
file with a record for your account.report
. For it to be considered as a tax report, you need to provide it with the right root_report_id
.
<odoo>
<record id="tax_report" model="account.report">
<field name="name">Tax Report</field>
<field name="root_report_id" ref="account.generic_tax_report"/>
<field name="country_id" ref="base.XX"/>
</record>
...
</odoo>
… 接着是其行的声明,作为 account.report.line
记录。
Example
addons/l10n_au/data/account_tax_report_data.xml
<record id="tax_report" model="account.report">
<field name="name">BAS Report</field>
<field name="root_report_id" ref="account.generic_tax_report"/>
<field name="country_id" ref="base.au"/>
<field name="filter_fiscal_position" eval="True"/>
<field name="availability_condition">country</field>
<field name="column_ids">
<record id="tax_report_balance" model="account.report.column">
<field name="name">Balance</field>
<field name="expression_label">balance</field>
</record>
</field>
<field name="line_ids">
<record id="account_tax_report_gstrpt_sale_total" model="account.report.line">
<field name="name">GST amounts you owe the Tax Office from sales</field>
<field name="hierarchy_level">0</field>
<field name="children_ids">
<record id="account_tax_report_gstrpt_g1" model="account.report.line">
<field name="name">G1: Total Sales (including any GST)</field>
<field name="code">G1</field>
<field name="expression_ids">
<record id="account_tax_report_gstrpt_g1_tag" model="account.report.expression">
<field name="label">balance</field>
<field name="engine">tax_tags</field>
<field name="formula">G1</field>
</record>
</field>
<field name="children_ids">
<record id="account_tax_report_gstrpt_g2" model="account.report.line">
<field name="name">G2: Export sales</field>
<field name="code">G2</field>
<field name="expression_ids">
<record id="account_tax_report_gstrpt_g2_tag" model="account.report.expression">
<field name="label">balance</field>
<field name="engine">tax_tags</field>
<field name="formula">G2</field>
</record>
</field>
</record>
财政状况¶
Specify fiscal positions in the data/template/account.fiscal.position-xx.csv
file.
Example
addons/l10n_es/data/template/account.fiscal.position-es_common.csv
"id","sequence","name","name@es","name@ca","auto_apply","vat_required","country_id","country_group_id","tax_ids/tax_src_id","tax_ids/tax_dest_id","account_ids/account_src_id","account_ids/account_dest_id"
"fp_nacional","1","Domestic","Régimen Nacional","Règim nacional","1","1","base.es","","","","",""
"fp_intra_private","2","EU private","EU privado","EU privat","1","","","base.europe","","","",""
"fp_intra","3","Intra-community","Régimen Intracomunitario","Règim intracomunitari","1","1","","base.europe","account_tax_template_p_iva0_s_bc","account_tax_template_p_iva0_ic_bc","",""
"","","","","","","","","","account_tax_template_p_iva0_s_sc","account_tax_template_p_iva0_ic_sc","",""
"","","","","","","","","","account_tax_template_p_iva2_bc","account_tax_template_p_iva2_ic_bc","",""
"","","","","","","","","","account_tax_template_p_iva2_sc","account_tax_template_p_iva2_ic_sc","",""
"","","","","","","","","","account_tax_template_p_iva4_bc","account_tax_template_p_iva4_ic_bc","",""
"","","","","","","","","","account_tax_template_p_iva4_sc","account_tax_template_p_iva4_sp_in","",""
"","","","","","","","","","account_tax_template_p_iva4_bi","account_tax_template_p_iva4_ic_bi","",""
"","","","","","","","","","account_tax_template_p_iva5_bc","account_tax_template_p_iva5_ic_bc","",""
"","","","","","","","","","account_tax_template_p_iva5_sc","account_tax_template_p_iva5_ic_sc","",""
"","","","","","","","","","account_tax_template_p_iva7-5_bc","account_tax_template_p_iva7-5_ic_bc","",""
"","","","","","","","","","account_tax_template_p_iva7-5_sc","account_tax_template_p_iva7-5_ic_sc","",""
"","","","","","","","","","account_tax_template_p_iva10_bc","account_tax_template_p_iva10_ic_bc","",""
"","","","","","","","","","account_tax_template_p_iva10_sc","account_tax_template_p_iva10_sp_in","",""
"","","","","","","","","","account_tax_template_p_iva10_bi","account_tax_template_p_iva10_ic_bi","",""
"","","","","","","","","","account_tax_template_p_iva21_bc","account_tax_template_p_iva21_ic_bc","",""
"","","","","","","","","","account_tax_template_p_iva21_sc","account_tax_template_p_iva21_sp_in","",""
"","","","","","","","","","account_tax_template_p_iva21_bi","account_tax_template_p_iva21_ic_bi","",""
"","","","","","","","","","account_tax_template_s_iva0b","account_tax_template_s_iva0_ic","",""
"","","","","","","","","","account_tax_template_s_iva0s","account_tax_template_s_iva0_sp_i","",""
"","","","","","","","","","account_tax_template_s_iva2b","account_tax_template_s_iva0_ic","",""
"","","","","","","","","","account_tax_template_s_iva2s","account_tax_template_s_iva0_sp_i","",""
"","","","","","","","","","account_tax_template_s_iva4b","account_tax_template_s_iva0_ic","",""
"","","","","","","","","","account_tax_template_s_iva4s","account_tax_template_s_iva0_sp_i","",""
"","","","","","","","","","account_tax_template_s_iva5b","account_tax_template_s_iva0_ic","",""
"","","","","","","","","","account_tax_template_s_iva5s","account_tax_template_s_iva0_sp_i","",""
"","","","","","","","","","account_tax_template_s_iva7-5b","account_tax_template_s_iva0_ic","",""
"","","","","","","","","","account_tax_template_s_iva7-5s","account_tax_template_s_iva0_sp_i","",""
"","","","","","","","","","account_tax_template_s_iva10b","account_tax_template_s_iva0_ic","",""
"","","","","","","","","","account_tax_template_s_iva10s","account_tax_template_s_iva0_sp_i","",""
"","","","","","","","","","account_tax_template_s_iva21b","account_tax_template_s_iva0_ic","",""
"","","","","","","","","","account_tax_template_s_iva21s","account_tax_template_s_iva0_sp_i","",""
"","","","","","","","","","account_tax_template_s_iva21isp","account_tax_template_s_iva0_ic","",""
"","","","","","","","","","","","account_common_7000","account_common_7001"
"","","","","","","","","","","","account_common_7010","account_common_7011"
"","","","","","","","","","","","account_common_7020","account_common_7021"
"","","","","","","","","","","","account_common_7030","account_common_7031"
"","","","","","","","","","","","account_common_7040","account_common_7041"
"","","","","","","","","","","","account_common_7050","account_common_7051"
"fp_extra","4","Extra-community","Régimen Extracomunitario","Règim extracomunitari","1","","","","account_tax_template_p_iva0_s_bc","account_tax_template_p_iva0_ibc","",""
"","","","","","","","","","account_tax_template_p_iva0_s_sc","account_tax_template_p_iva0_isc","",""
"","","","","","","","","","account_tax_template_p_iva2_bc","account_tax_template_p_iva2_ibc","",""
"","","","","","","","","","account_tax_template_p_iva2_sc","account_tax_template_p_iva2_isc","",""
"","","","","","","","","","account_tax_template_p_iva4_bc","account_tax_template_p_dua_exempt","",""
"","","","","","","","","","account_tax_template_p_iva4_sc","account_tax_template_p_iva4_sp_ex","",""
"","","","","","","","","","account_tax_template_p_iva4_bi","account_tax_template_p_iva4_ibi","",""
"","","","","","","","","","account_tax_template_p_iva5_bc","account_tax_template_p_dua_exempt","",""
"","","","","","","","","","account_tax_template_p_iva5_sc","account_tax_template_p_iva5_isc","",""
"","","","","","","","","","account_tax_template_p_iva7-5_bc","account_tax_template_p_iva7-5_ibc","",""
"","","","","","","","","","account_tax_template_p_iva7-5_sc","account_tax_template_p_iva7-5_isc","",""
"","","","","","","","","","account_tax_template_p_iva10_bc","account_tax_template_p_dua_exempt","",""
"","","","","","","","","","account_tax_template_p_iva10_sc","account_tax_template_p_iva10_sp_ex","",""
最后的步骤¶
最后,您可以添加一个演示公司,以便可以在演示模式下轻松测试本地化。
Example
addons/l10n_ch/demo/demo_company.xml
<record id="base.partner_demo_company_ch" model="res.partner" forcecreate="1">
<field name="name">CH Company</field>
<field name="vat">CHE-530781296TVA</field>
<field name="street">14 Meierskappelerstrasse</field>
<field name="city">Risch-Rotkreuz</field>
<field name="country_id" ref="base.ch"/>
<field name="zip">6343</field>
<field name="phone">+41 78 123 45 67</field>
<field name="email">info@company.chexample.com</field>
<field name="website">www.chexample.com</field>
</record>
<record id="base.demo_bank_ch" model="res.partner.bank" forcecreate="1">
<field name="acc_type">iban</field>
<field name="acc_number">CH4431999123000889012</field>
<field name="partner_id" ref="base.partner_demo_company_ch"/>
</record>
<record id="base.demo_company_ch" model="res.company" forcecreate="1">
<field name="name">CH Company</field>
<field name="partner_id" ref="base.partner_demo_company_ch"/>
</record>
<function model="res.company" name="_onchange_country_id">
<value eval="[ref('base.demo_company_ch')]"/>
</function>
<function model="res.users" name="write">
<value eval="[ref('base.user_root'), ref('base.user_admin'), ref('base.user_demo')]"/>
<value eval="{'company_ids': [(4, ref('base.demo_company_ch'))]}"/>
</function>
<function model="account.chart.template" name="try_loading">
<value eval="[]"/>
<value>ch</value>
<value model="res.company" eval="obj().env.ref('base.demo_company_ch')"/>
<value name="install_demo" eval="True"/>
</function>
会计报告¶
另请参阅
Accounting reports should be added via a separate module l10n_XX_reports
that should go to the enterprise repository.
基本 __manifest__.py
文件如下所示:
{
"name": "COUNTRY - Accounting Reports",
"category": "Accounting/Localizations/Reporting",
"version": "1.0.0",
"license": "OEEL-1",
"depends": [
"l10n_XX", "account_reports"
],
"data": [
"data/balance_sheet.xml",
"data/profit_and_loss.xml",
],
"auto_install": True,
}
财务报告的功能概述在这里: 报告 .
一些好的例子:
您可以在此处查看字段的含义:
If you gave a root_report_id
to your report, it is now available in its variant selector. If not,
you still need to add a menu item for it. A default menu item can be created from the form view of
the report by clicking on . You will then need to
refresh the page to see it. Alternatively, to create a dedicated section for a totally new report in
the Reporting menu, you need to create a new ir.ui.menu
record (usually in the main
l10n_XX
module) and a new ir.actions.client
(usually in the new report XML file) that calls the
account.report
with the new report id. Then, set the new menu as parent_id
field in the
action model.