本地化指南

OpenERP Localization is the process of writing the necessary configuration or the customizations required to make OpenERP suitable for a general purpose use in a particular country.

Usually the first step for creating a localization (a.k.a. l10n) is to configure one (or more) Chart(s) of Accounts for the country, with the related dependencies: Account types, Taxes, etc.

This section gives a few guidelines to assist in the creation of a correct l10n_XXX module. Once the new l10n module meets the following requirements, it can be considered for inclusion in the official OpenERP addons, via a merge proposal process (as described in 合并申请 & 修补程序).

小技巧

Reference and Examples

Have a look at the Belgian localization module (l10n_be) to get started, and for references and examples of how a localization module is structured

本地化模块的内容

In order to have a localization module fully complete, you should ensure that the following features are present in your module:

  • chart of account and chart of taxes are mandatory, and must meet the guidelines defined below. It’s quite possible to put multiple chart templates in the same l10n module

  • bank interfaces (import - export)

  • legal reports (no business reports, these could be in a separate module)

Most of the time it’s preferable that localization modules do not contain any Python code that would interfere with the normal behavior of OpenERP’s core (such as inherited/overridden methods). It’s also preferable that they do not reimplement existing features (e.g. don’t add a wizard to generate the chart of account, use the existing one).

If you think the OpenERP accounting report engine does not fit the legal requirements for your country, you can make a merge proposal (see 合并申请 & 修补程序) to improve the core accounting engine.

The next sections provide guidelines for writing the most critical parts of you l10n modules, in the preferred order of writing.

通用指南

  • The module must be named l10n_XX where XX is the lower case country code, taken from http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2

  • l10n_XX 模块必须像所有的OpenERP模块一样,放在Launchpad主机

  • l10n_XX 模块布线在bzr分支,这个分支是:

    • lp:openobject-addons 的一个分支

    • 或是一个只包含此模块的分支(这种情况下,应该将其加入到 lp:openobject-addons 的一个分支中,以便提出合并到官方插件的请求)。

  • 模块不能定义科目表,只能够定义 科目表模板 (charts templates)

  • 全部的本地化必须包含在唯一一个包含了法律要求的模块中:

    • 会计科目表

    • 税结构

    • 法律条款(报告),如果有

    • tax declarations, if any

    • 如果有,银行的导入、导出特性

  • Extra features which are not legal requirements but best practices of the country can be in separate modules (such as special kind of discounts, some special tax for very specific situations, etc.)

科目类型指南 (account.account.type)

例子

资产,负债…

描述

类别包含了很多关于账户及其细节特性的信息。

It’s important to pay attention to the deferral method field (named close_method) because it will define the way your accounts will create or not new entries when opening a new fiscal year. You should choose:

  • 详情(detail) 是为那些需要完整报告的内容设立的,即便是这些内容已经核销了。

  • 无(none) 是为那些根本不需要报告的内容设立的

Make also sure to give a corresponding value for the new field report_type (new as of v6) because it’s used in balance sheet and P&L report to know in which column to display it. You must have at least one account with report_type ‘/‘ (net profit).

科目表指南 (account.account.template)

在创建会计科目表时,你需要特别关注的资本信息是叫做 类型(type) 的内部类型字段,因为这个字段在OpenERP的很多地方会用到:

  • 应收(receivable) 是用于客户账户的类型

  • 应付(payable) 是用于供应商的账户

  • 视图(view) 是用于“非叶”(译注:这里指该分类不是底层的分类,它的下面还有更详细的分类)账户,用于把组织财务科目表形成一个树状的分支结构,OpenERP不接受任何``视图(view)`` 类型的账户实体存在(译注:他们是由子分支计算出来的)。

  • 流动资产(liquidity) 用于现金/银行账户(OpenERP 6 新增)

对于其他的账户(通常只有一个),应该选择内部类型为 其他(other)。

Important: Create templates of charts of accounts, not real charts of accounts, as the Chart Of Accounts is not global, it’s a template that needs to be applied for each company.

这也是你通过 用户类型user_type 字段用来分类你的账户类型(如前一节所解释的)的地方。

确保会计科目表是树状结构。

税码表指南 (account.tax.code.template)

This object is the same in v5 and v6. The hierarchical structure of the Chart of Tax Codes should allow you to compute the sum/totals easily as legally required in your country.

每项税的代码名称必须要符合法律规定。

这是一个最小的税结构科目表:

  • Tax Balance to Pay

    • 已缴税款

      • Tax Paid 21%

      • Tax Paid 0%

    • 已收税款

      • Tax Received 21%

      • Tax Received 0%

    • 计税基准

      • 应税销售基准

      • 基准销项税率21%

      • 应税采购基准

      • 基准进项税率21%

The code of each tax code must be the code of the tax section/cell for this amount in your monthly/yearly legal tax declaration. Leave the tax code empty if you don’t want that code to appear in the legal tax statement (i.e. for chart structure purposes)

科目表指南 account.chart.template

Once all above objects are created, you can focus on the Chart Template. It specifies the required information for generating the proper chart of account, taxes, etc. when you install this chart via the Chart of Account installation wizard.

信息包括:

  • chart of account: the account_root_id field provides the root account (with parent_id = False) of your chart

  • chart of tax: the tax_code_root_id field provides the root tax code (with parent_id = False) of your chart

  • parent of the bank/cash accounts: the bank_account_view_id field selects the account (within your chart) under which the bank and cash accounts will be created by OpenERP

  • default receivable account: the property_account_receivable field selects the account of your chart that will be used by default as customer account for each new partner

  • default payable account: the property_account_payable field selects the account of your chart that will be used by default for the supplier account of new partners

  • default expense accounts: the property_account_expense_categ field selects the account of your chart that will be used by default for the expense account of each new product

  • default income account: the property_account_income_categ selects the account of your chart that will be used by default for the income account of each new product

  • As of v6, a new field has been introduced for Reserve and Profit/Loss Account, named property_reserve_and_surplus_account. This fields select the account used for transferring amounts from Profit & Loss Report.

税项指南 (account.tax.template)

The only change in that object for v6 is the removal of the tax_group field which was unused. When testing the taxes, you should make sure that:

  • 为其创建的会计凭证无误:正确的科目和借贷方

  • 归集到增值税额代码下的税额是正确的

这里应该对发票和退款进行核对。

用 chart_template_id 连接税和上面定义的 account.chart.template 对象。

检查确认每项税都与账户、税代码以及基础税代码相连接。

财务结构指南 (account.fiscal.position.template)

Fiscal position objects stay the same in v6. They’re used to automatically map the default tax/account for a product according to Partner-specific situations (for invoices, sale and purchase orders).

在欧洲至少需要3中财务状况:

  • 国内客户

  • 国外的欧洲客户

  • 国外欧洲以外的客户

This tax and account mapping will allow you to keep a generic VAT, let’s say 21% (Belgian VAT), and a corresponding income account “sales in Belgium” on your products. When invoicing a customer that has the fiscal position ‘in Europe’, those values will be automatically changed into (for example) the corresponding 0% VAT and “sales in Europe” account.

使用 chart_template_id 字段把财务状况和上面定义的 account.chart.template 对象链接起来。

检查确认每个 l10n 模块都有至少定义了两个财务状况:

  • 一个为全国的客户而准备。

  • 一个或者多个国外客户

模块依赖指南

如果模块是来自欧洲国家,必须依赖“base_vat”模块

Avoid to put specific features in your l10n_XX module if it’s not related to legal requirement. New accounting features (example: discount on payment, etc.) must be in another and generic module, not in a l10n_XX module. Also, the l10n_XX module should not depend (require) on these other modules, which may not be included into official addons.

对于法律要求的项目是国家特定的(例如:强制性的电子申报纳税系统),你可以再次基础上在l10n_xx模块之间增加新的特性。

特定报表指南

如果你的国家对于某些报表有特殊的法律要求(比如 l10n_be 模块中产生XML增值税报表),这些这对你们国家的本地化模块应该是正确额选择。

在此提醒你:请看l10n_be的例子或者引用