カスタムレポート¶
Odooには強力で使いやすいレポートフレームワークが搭載されています。このエンジンにより、税務レポート や 貸借対照表、損益計算書 などの新しいレポートを、特定のグルーピング や レイアウト で作成することができます。
重要
会計レポート作成インターフェースにアクセスするには、開発者モード <developer-mode>を有効にします。
To create a new report, open the Accounting app and navigate to . From here, you can either create a root report or a variant.
ルートレポート¶
ルートレポートは、一般的で中立的な会計レポートとみなすことができます。ルートレポートは、ローカル会計バージョンを構築するためのモデルとして機能します。レポートにルートレポートがない場合、それ自体がルートレポートであると見なされます。
Example
ベルギーとアメリカの税レポートは、同じ一般的なバージョンをベースにして、それぞれの国内規制に合わせることになります。
When creating a new root report, you need to create a menu item for it. To do so, open the report and, on that same report, click the (Actions) icon, then select Create Menu Item. Refresh the page; the report is now available under .
注釈
新しいルートレポートを作成する必要があるケースは、その国の税務当局が新しい特定のタイプのレポートを要求する場合など、稀です。
バリアント¶
バリアントはルートレポートの国別バージョンであるため、常にルートレポートを参照します。バリアントを作成するには、新しいレポートを作成する際に ルートレポート フィールドで汎用(ルート)レポートを選択して下さい。
ルートレポートが会計アプリのメインメニューの一つから開かれると、その全てのバリアントがビューの右上隅にあるバリアントセレクタに表示されます。
Example
以下の画像では、VATレポート(BE) がルート 汎用税レポート のバリアントです。
Report lines¶
After having created a report (either root or variant), you need to fill it with report lines. You can either create a new one by clicking on Add a line, or modify an existing report line by clicking on it. All report lines require a Name, and can have an optional additional Code (of your choice) if you wish to use their value in formulas.
式¶
Each report 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 report line.
When creating an expression, you must attribute a Label used to refer to that expression. Therefore, it has to be unique among the expressions of each line. Both a Computation Engine and a Formula must also be indicated. The engine defines how your formula(s) and subformula(s) are interpreted. It is possible to mix expressions using different computation engines under the same line if you need to.
注釈
エンジンによっては、サブ式 も必要な場合があります。
'Odooドメイン' エンジン¶
このエンジンでは、数式は Odooドメイン と解釈され、account.move.line オブジェクトを対象とします。
このサブ計算式によって、ドメインに一致する仕訳明細をどのように使って式の値を計算するかを定義することができます:
sum一致した仕訳明細の全残高の合計です。
sum_if_pos一致した仕訳明細の残高の合計です。そうでなければ
0です。sum_if_neg金額が負であれば、結果は一致した仕訳明細の残高の合計となります。そうでなければ
0です。count_rowsThe result is the number of sub-lines of this expression. If the report 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.
また、サブ計算式の先頭に - 記号を付けると、結果の符号を 反転 させることができます。
'その他の計算式の集計'エンジン¶
Use this engine when you need to perform arithmetic operations on the amounts obtained for 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 report 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 サブ計算式を使用して、別のレポートにある式に一致させることもできます。
'勘定コードのプレフィックス'エンジン¶
このエンジンは、勘定科目コードのプレフィックスを算術式の変数として使用し、勘定科目の金額を照合するために使用されます。
Example
21Example
21 + 10 - 521 と 10 で始まる勘定科目の仕訳明細の残高を加算し、プレフィクスが 5 の勘定科目の仕訳明細の残高を減算します。サブプレフィックスの選択を無視することも可能です。
Example
21 + 10\(101, 102) - 5\(57)102、57 は無視されます。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 は残高が 貸方 であるため、参照されません。
プレフィクスの除外はサフィックスの C や D と混ぜることができます。
Example
21D + 10\(101, 102)C - 5\(57)D)の 場合 は 21、貸方(C)の 場合 は 10 で始まる勘定科目の残高を足し合わせますが、プレフィックス 101、102 は無視し、プレフィックス 57 は無視してプレフィックス 5 で始まる勘定科目の残高を引きます。プレフィクスの C または D に一致し、サフィックスとして使用しない場合は、空の除外文字 () を使用します。
Example
21D\()21D で始まる勘定科目に一致します。コードプレフィクスを使って勘定科目を含めるだけでなく、勘定科目タグ で一致させることもできます。これは、例えば、あなたの国に標準化された勘定科目表がなく、同じプレフィクスが企業間で異なる目的で使用される可能性がある場合に特に便利です。
Example
tag(25)参照するタグがデータファイルで定義されている場合は、idの代わりにxmlidを使うことができます。
Example
tag(my_module.my_tag)また、タグに算術式を使うこともでき、プレフィクス選択と組合わせることもできます。
Example
tag(my_module.my_tag) + tag(42) + 1010 の勘定科目の残高と合計されます。`C`と`D`のサフィックスもタグと同じように使うことができます。
Example
tag(my_module.my_tag)Cプレフィクスの除外はタグでも機能します。
Example
tag(my_module.my_tag)\(10)10 で始まらないコードを持つ勘定科目に一致します。'外部値' エンジン¶
'外部値' エンジンは、手動値 および 繰越値 を参照するために使用されます。これらの値は account.move.line ではなく、account.report.external.value で保存されます。これらのオブジェクトはそれぞれ、それが影響を与える式を直接指しているので、ここで選択することはあまりありません。
式 は以下のいずれかになります:
sumその結果が、その期間内の全ての外部値の合計でなければならない場合。
most_recentその結果が、その期間の最新の外部値の値でなければならない場合。
さらに、サブ計算式 は2つの方法で使用することができます:
rounding=XXを数字に置き換えると、X桁に丸めることを指示します。editableこの式を手動で編集できることを示し、レポートにアイコンを表示して、ユーザがこの操作を実行できるようにします。
注釈
手動値は、現在レポートで選択されている date_to で作成されます。
どちらのサブ計算式も ; で区切ることで混在させることができます。
Example
editable;rounding=2'カスタムPython関数' エンジン¶
このエンジンは、開発者がケースバイケースで式のカスタム計算を導入するための手段です。式は呼び出す python 関数 の名前であり、サブ計算式はこの関数が返す 辞書 から取り出す キー です。独自のカスタムモジュールを作成する場合にのみ使用して下さい。
列¶
レポートには、不明な数 の列が表示される場合があります。各列は 行 で明示された 式 から値を得ます。列の expression_label フィールドは、値が表示される式のラベルを表示します。そのフィールドに 式 がない行がある場合、この列には何も表示されません。 複数の列が必要な場合は、異なる 式 ラベルを使用する必要があります。
会計レポートの オプション タブにある 期間比較 機能を使用すると、全ての列が各期間で繰返されます。
Custom tax report setup¶
Report configuration¶
ちなみに
All technical terms and functions of Odoo's reports engine are explained in the previous sections of this page. We strongly recommend reading these sections before setting up a custom tax report.
To create a custom tax report, open the Accounting app, navigate to , then click New:
Enter a name for your report.
Select a Root Report.
Under the Availability field, select Country Matches, then select the Country matching your company.
Next, create a report line by clicking the Add a line. Once created, click that report line to configure it:
Click Add a line again to create an Expression and name it.
In the Definition tab, select a Computation Engine for that expression depending on the following scenarios:
In this scenario, your company uses tax grids:
Select Tax Tags as the computation engine. Odoo uses this field to link the report line to your taxes.
In the Formula field, type your short grid identifier (e.g.,
vat_sales_base). Odoo automatically generates the+and-variants of this tag for you to map inside .In the Subformula field, enter either
baseto report the untaxed amount, ortaxto report the actual tax amount collected/paid.
Repeat this process as necessary. Then, Save & Close.
Alternatively, you can:
Select Aggregate Other Formulas as the computation engine. Odoo uses this field to perform math on lines already present in the report rather than scanning raw transactions.
In the Formula field, use basic algebra referencing your line codes (e.g.,
LINE_10 - LINE_20).
Repeat this process as necessary. Then, Save & Close.
In this scenario, your company does not use tax grids. Instead, it tracks everything strictly via General Ledger accounts:
Select Prefix of Account Codes as the computation engine: Odoo uses this for lines that need to pull financial totals. Instead of looking for transaction tags, Odoo pulls live balances directly from your chart of accounts.
In the Formula field, type the starting digits of the accounts you want to track, (e.g.,
40will pull the combined total of all revenue accounts starting with400000,401000, etc.).
Repeat this process as necessary. Then, Save & Close.
Alternatively, you can:
Select Aggregate Other Formulas as the computation engine. Odoo uses this to calculate subtotals, net tax, or grand totals by adding or subtracting your other report lines.
In the Formula field, use basic algebra referencing your line codes (e.g.,
LINE_10 - LINE_20).
Repeat this process as necessary. Then, Save & Close.
In this scenario, your company requires advanced filtering, manual user overrides, or complex algorithmic logic that standard tags and account prefixes cannot handle:
Select Odoo Domain as the computation engine: Odoo uses this to bypass tax tags entirely and filter raw journal items (
account.move.line) using standard Odoo search syntax.In the Formula field, enter a valid domain starting with brackets to isolate tax-exempt transactions for specific partner categories.
Alternatively, you can:
Select External Value as the computation engine. Odoo uses this to log manual overrides or historical carryover values.
In the Formula field, type either
sum(to add all manual values together over multi-period reports) ormost_recent(to display only the latest value).In the Subformula field, type
editableto display an edit icon on the live report, allowing users to modify the value manually. Additionally, you can round numbers by typingrounding=x.
Alternatively, you can:
Select Custom Python Function as the computation engine. Odoo uses this as an execution engine to run specific calculations through backend coding when rules involve progressive brackets, loops, or multi-tier thresholds.
In the Formula field, enter the exact technical name of the Python method defined in your custom localization module.
Repeat this process as necessary. Then, Save & Close.
In the Options tab of an Expression, populate the Carry Over To field with a formula to always carry over balances or only carry them over when the amount is negative. Leave this field blank if you do not want to use this feature.
Example
if_below(EUR(0))Tax configuration¶
Next, go to and click New to create and configure new taxes for your custom tax report. Create your Sales and Purchases taxes, and populate the Tax Grids for all taxes using the matching tax grids you created earlier. Finally, make sure to specify both a tax payable and tax receivable account for each tax.
Example
Closing entry¶
To close taxes, a tax group must be specified on each tax used in your custom tax report. To do this, open the Accounting app, navigate to , open a tax that requires a tax group, click the Advanced Options tab, and select a group in the Tax Group field. Once assigned, click the (right arrow) icon and set both a Tax Payable Account and a Tax Receivable Account.
ちなみに
When everything has been set up, make sure to test your report by creating invoices, bills, and credit notes using the taxes specific to that report. Finally, test the closing entry itself.
If you want to hide a specific account from displaying in the tax closing entry, go to , select the tax, and click the (settings adjust) icon. From there, check the Tax Closing Entry box to adjust its visibility.