カスタムレポート

Odoo comes with a powerful and easy-to-use reporting framework. The engine allows you to create new reports, such as tax reports, balance sheets, and income statements with specific groupings and layouts.

重要

Activate the developer mode to access the accounting report configuration.

To create a new report, go to Accounting ‣ Configuration ‣ Accounting Reports. From here, create either a root report or a variant.

ちなみに

  • Consider saving modified reports as report variants to keep their root reports intact.

  • To access an existing report's management interface from the report itself, click on the (gears) icon.

ルートレポート

ルートレポートは、一般的で中立的な会計レポートとみなすことができます。ルートレポートは、ローカル会計バージョンを構築するためのモデルとして機能します。レポートにルートレポートがない場合、それ自体がルートレポートであると見なされます。

Example

ベルギーとアメリカの税レポートは、同じ一般的なバージョンをベースにして、それぞれの国内規制に合わせることになります。

Creating a menu item is required to access a new root report. To do so, open the report's configuration, click Action, Create Menu Item, and refresh the page. The report is now available under Accounting ‣ Reporting.

注釈

新しいルートレポートを作成する必要があるケースは、その国の税務当局が新しい特定のタイプのレポートを要求する場合など、稀です。

バリアント

バリアントはルートレポートの国別バージョンであるため、常にルートレポートを参照します。バリアントを作成するには、新しいレポートを作成する際に ルートレポート フィールドで汎用(ルート)レポートを選択して下さい。

When a root report is opened from the Accounting app's Reporting menu, all of its variants are displayed in the report variant selector in the top right corner of the view.

Example

VAT Report (BE) is a variant of the root Generic Tax report.

レポートバリアント選択

After creating a report (either root or variant), the next step is to fill it with lines. To create a new line, click on Add a line. To modify an existing line, click on the line itself and edit the popup. All lines require a Name and can have an optional Code which allows using the line's value in formulas.

エンジン明細オプション

Each line can contain one or multiple expressions. Expressions can be seen as sub-variables needed by a report line. To create an expression, click on Add a line within a line's popup.

When creating an expression, you must enter a Label used to refer to that expression. The label must be unique among the expressions of each report line. Both the Computation Engine and the Formula fields must also be completed. The computation engine defines how the formula(s) and subformula(s) are interpreted. It is possible to mix expressions using different computation engines under the same line if needed.

注釈

エンジンによっては、サブ式 も必要な場合があります。

Odoo Domain computation engine

When using the Odoo Domain computation engine, a formula is interpreted as an Odoo domain targeting account.move.line objects.

このサブ計算式によって、ドメインに一致する仕訳明細をどのように使って式の値を計算するかを定義することができます:

sum

一致した仕訳明細の全残高の合計です。

sum_if_pos

一致した仕訳明細の残高の合計です。そうでなければ 0 です。

sum_if_neg

金額が負であれば、結果は一致した仕訳明細の残高の合計となります。そうでなければ 0 です。

count_rows

The result is the number of sub-lines of this expression. If the parent line has a group-by value, this will correspond to the number of distinct grouping keys in the matched move lines. Otherwise, it will be the number of matched move lines.

ちなみに

To reverse the sign of the result, put a - sign at the beginning of the subformula.

明細レポート内の数式明細

Tax Tags computation engine

When using the Tax Tags computation engine, the contents of the Formula field are matched to tax tags. If such tags do not exist when creating the expression, they will be created.

式を評価する場合、式の計算はおおよそ次のように表すことができます: (タグが + の仕訳明細の金額) - (タグが - の仕訳明細の金額) です。

Example

If the Formula is set to tag_name, the engine matches tax tags +tag_name and -tag_name, creating them if necessary. To exemplify further: two tags are matched by the formula. If the formula is A, it will require (and create, if needed) tags +A and -A.

Aggregate Other Formulas computation engine

The Aggregate Other Formulas computation engine performs arithmetic operations on the amounts obtained from other expressions. Formulas here are composed of references to expressions separated by one of the four basic arithmetic operators (addition +, subtraction -, division /, and multiplication *). To refer to an expression, type in its parent line's code followed by a period . and the expression's label (ex. code.label).

サブ式 は以下の1つであることが可能です:

if_above(CUR(amount))

算術式の値は、指定された境界よりも大きい場合にのみ返されます。そうでなければ、結果は 0 となります。

if_below(CUR(amount))

算術式の値は、指定された境界よりも小さい場合にのみ返されます。そうでなければ、結果は 0 となります。

if_between(CUR1(amount1), CUR2(amount2))

算術式の値は、指定された境界の間に厳密に入っている場合のみ返される。そうでない場合は、最も近い境界に戻されます。

if_other_expr_above(LINE_CODE.EXPRESSION_LABEL, CUR(amount))

算術式の値は、指定された行コードと数式ラベルで示される式の値が、指定された境界よりも大きい場合にのみ返されます。そうでなければ、結果は 0 となります。

if_other_expr_below(LINE_CODE.EXPRESSION_LABEL, CUR(amount))

算術式の値は、指定された明細コードと式ラベルで示される式の値が、指定された境界よりも小さい場合にのみ返されます。そうでなければ、結果は 0 となります。

CUR`は大文字の通貨コードで、`金額`はその通貨で表示された限界額です。

また、cross_report サブ計算式を使用して、別のレポートにある式に一致させることもできます。

Prefix of Account Codes computation engine

The Prefix of Account Codes computation engine is used to match amounts made on accounts using the prefixes of these accounts' codes as variables in an arithmetic expression.

Example

21
算術式は、次のようプレフィックス1つで表すこともできます。

Example

21 + 10 - 5
この計算式は、コードが 2110 で始まる勘定科目の仕訳明細の残高を加算し、プレフィクスが 5 の勘定科目の仕訳明細の残高を減算します。

サブプレフィックスの選択を無視することも可能です。

Example

21 + 10\(101, 102) - 5\(57)
この式は前の例と同じように機能しますが、プレフィックスの 101`、10257 は無視されます。

You can apply 'sub-filtering' on credits and debits using the C and D suffixes. In this case, an account will only be considered if its prefix matches, and if the total balance of the move lines made on this account is credit/debit.

Example

勘定科目 210001 の残高は -42 で、勘定科目 210002 の残高は25です。数式 21D は勘定科目 210002 にのみマッチし、したがって25を返します。210001 は残高が 貸方 であるため、参照されません。

プレフィクスの除外はサフィックスの CD と混ぜることができます。

Example

21D + 10\(101, 102)C - 5\(57)
この計算式は、勘定科目コードが借方(D)の 場合21、貸方(C)の 場合10 で始まる勘定科目の残高を足し合わせますが、プレフィックス 101102 は無視し、プレフィックス 57 は無視してプレフィックス 5 で始まる勘定科目の残高を引きます。

プレフィクスの C または D に一致し、サフィックスとして使用しない場合は、空の除外文字 () を使用します。

Example

21D\()
この計算式は、残高の符号に関係なく、コードが 21D で始まる勘定科目に一致します。

コードプレフィクスを使って勘定科目を含めるだけでなく、勘定科目タグ で一致させることもできます。これは、例えば、あなたの国に標準化された勘定科目表がなく、同じプレフィクスが企業間で異なる目的で使用される可能性がある場合に特に便利です。

Example

tag(25)
This formula matches accounts whose associated tags contain the one with ID 25.

If the tag you reference is defined in a data file, an XMLID can be used instead of the ID.

Example

tag(my_module.my_tag)
この式は、関連するタグが my_module.my_tag で示されるタグを含む勘定科目に一致します。

また、タグに算術式を使うこともでき、プレフィクス選択と組合わせることもできます。

Example

tag(my_module.my_tag) + tag(42) + 10
my_module.my_tag としてタグ付けされた勘定科目の残高は、ID 42 のタグにリンクされた勘定科目およびコードプレフィックス 10 の勘定科目の残高と合計されます。

`C`と`D`のサフィックスもタグと同じように使うことができます。

Example

tag(my_module.my_tag)C
この式は、my_module.my_tag というタグと貸方残高を持つ勘定科目に一致します。

プレフィクスの除外はタグでも機能します。

Example

tag(my_module.my_tag)\(10)
この式は、my_module.my_tag というタグと、10 で始まらないコードを持つ勘定科目に一致します。

External Value computation engine

The External Value computation engine is used to refer to manual and carryover values. Those values are not stored using account.move.line, but with account.report.external.value. Each of these objects directly points to the expression it impacts, so very little needs to be done about their selection here.

は以下のいずれかになります:

sum

その結果が、その期間内の全ての外部値の合計でなければならない場合。

most_recent

その結果が、その期間の最新の外部値の値でなければならない場合。

さらに、サブ計算式 は2つの方法で使用することができます:

rounding=X

 X を数字に置き換えると、X桁に丸めることを指示します。

editable

この式を手動で編集できることを示し、レポートにアイコンを表示して、ユーザがこの操作を実行できるようにします。

注釈

手動値は、現在レポートで選択されている date_to で作成されます。

どちらのサブ計算式も ; で区切ることで混在させることができます。

Example

editable;rounding=2
This subformula shows the correct way to mix both behaviors.

Custom Python Function computation engine

The Custom Python Function computation engine is a means for developers to introduce custom computation of expressions on a case-by-case basis. The Formula is the name of a python function to call, and the Subformula is a key to fetch in the dictionary returned by this function. Use this computation engine only if making a custom module.

カラム

レポートには、不明な数 の列が表示される場合があります。各列は で明示された から値を得ます。列の expression_label フィールドは、値が表示される式のラベルを表示します。そのフィールドに がない行がある場合、この列には何も表示されません。 複数の列が必要な場合は、異なる ラベルを使用する必要があります。

レポートの列。

会計レポートの オプション タブにある 期間比較 機能を使用すると、全ての列が各期間で繰返されます。

Line grouping

Non-standard grouping is possible by adding or using existing fields on the Journal Item model, provided that the fields are related and non-stored.

注釈

Grouping lines requires the report to have explicit report lines that can be edited. The deferred reports, for example, do not support grouping lines as they use dynamic lines that are generated.

Create a new field on journal item

To create a non-stored, related field in the Journal Item model, first go to Accounting ‣ Journal Items, and click the (bug) icon, then click Fields. Click New to create a new field, and complete the following fields:

  • Field Name: a technical name for the field

  • Field Label: the label to be displayed for the field

  • Field Type: the type of field that this related field should point to

  • Stored: Leave this field unchecked as only non-stored fields can be used to group lines.

  • Related Model: If the field type is one2many, many2many, or many2one, select the model of the original field to group by.

  • Related Field Definition: the technical path to the field you want to group by

    Example

    To group by the sales team of the commercial partner, set the related field definition to move_id.team_id.

Group lines

To group lines, go to the Lines tab of the desired report, click on the line you want to group, and edit the Group by field. Enter the technical name (Field Name) of the field to use as the grouping key.

ちなみに

To find a list of all the model's fields and their technical names, go to Accounting ‣ Journal Items, and click the (bug) icon, then click Fields. The technical name of each field is listed in the Field Name column.