Laporan kustom

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.

Penting

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.

Tip

  • 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.

Root reports

Root report dapat dianggap sebagai laporan akuntansi yang netral dan umum. Mereka bertindak sebagai model pada mana versi akuntansi lokal akan dibangun. Bila laporan tidak memiliki root report, maka akan dianggap sebagai root report itu sendiri.

Example

Laporan pajak untuk Belgia dan AS akan masing-masing menggunakan versi umum yang sama sebagai dasar dan mengadaptasikannya untuk regulasi domestik.

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.

Catatan

Kasus yang memerlukan pembuatan root report baru itu langka, seperti pada kasus di mana otoritas pajak negara memerlukan tipe laporan yang baru dan khusus.

Varian

Variant adalah versi khusus negara dari root report dan, oleh karena itu, selalu merujuk ke root report. Untuk membuat variant, pilih root report umum di field Root Report saat membuat laporan baru.

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.

Pemilihan laporan variant.

Baris

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.

Opsi baris engine.

Expression

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.

Catatan

Tergantung pada enginenya, subformula juga mungkin diperlukan.

Odoo Domain computation engine

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

Subformula ini memungkinkan Anda untuk mendefinisikan bagaimana baris pergerakkan yang cocok dengan domain digunakan untuk menghitung nilai dari expression:

sum

Hasilnya adalah jumlah dari semua saldo dari baris pergerakkan yang cocok.

sum_if_pos

Hasilnya adalah jumlah dari semua saldo dari baris pergerakkan yang cocok bila jumlahnya positif. Bila tidak, adalah 0.

sum_if_neg

Hasilnya adalah jumlah dari semua saldo dari baris pergerakkan yang cocok bila jumlahnya negatif. Bila tidak, adalah 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.

Tip

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

Baris expression dalam laporan baris

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.

Saat mengevaluasi expression, perhitungan expression dapat secara kasar diekspresikan sebagai: (jumlah baris pergerakkan dengan tag + ) - (jumlah baris pergerakkan dengan tag - ).

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).

Subformula dapat merupakan salah satu dari yang berikut:

if_above(CUR(amount))

Nilai dari ekspresi aritmetika akan dikembalikkan hanya bila lebih besar dari nilai yang disediakan sebelumnya. Bila tidak, hasilnya akan menjadi 0.

if_below(CUR(amount))

Nilai dari ekspresi aritmetika akan dikembalikkan hanya bila lebih kecil dari nilai yang disediakan sebelumnya. Bila tidak, hasilnya akan menjadi 0.

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

Nilai dari ekspresi aritmetika akan dikembalikkan hanya bila di antara nilai yang disediakan sebelumnya. Bila tidak, hasilnya akan menjadi 0.

if_other_expr_above(LINE_CODE.EXPRESSION_LABEL, CUR(amount))

Nilai dari ekspresi aritmetika akan dikembalikkan hanya bila nilai ekspresi yang ditunjukkan oleh baris kode dan label expression lebih besar dari nilai yang disediakan sebelumnya. Bila tidak, hasilnya akan menjadi 0.

if_other_expr_below(LINE_CODE.EXPRESSION_LABEL, CUR(amount))

Nilai dari ekspresi aritmetika akan dikembalikkan hanya bila nilai ekspresi yang ditunjukkan oleh baris kode dan label expression lebih kecil dari nilai yang disediakan sebelumnya. Bila tidak, hasilnya akan menjadi 0.

CUR adalah kode mata uang yang huruf besar, dan jumlah adalah jumlah nilai yang diekspresikan dalam mata uang tersebut.

Anda juga dapat menggunakan subformula cross_report untuk mencocokkan expression yang ditemukan di laporan lain.

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
Ekspresi aritmetika juga dapat merupakan satu awalan, seperti di sini.

Example

21 + 10 - 5
Formula ini menambahkan saldo dari baris-baris pergerakkan yang dibuat pada akun yang kodenya dimulai dengan 21 dan 10, dan mengurangi saldo dari mereka yang akunnya dimulai dengan 5.

Anda juga dapat mengabaikan pilihan sub-awalan.

Example

21 + 10\(101, 102) - 5\(57)
Formula ini juga bekerja dengan cara yang sama seperti contoh sebelumnya tapi mengabaikan awalan 101, 102, dan 57.

Anda dapat menerapkan 'sub-filter` pada kredit dan debit menggunakan akhiran C dan D. Pada kasus ini, akun hanya akan dianggap bila awalannya cocok, dan bila total saldo baris pergerakkan yang dibuat pada akun adalah kredit/debit.

Example

Akun 210001 memiliki saldo -42 dan akun 210002 memiliki saldo 25. Formula 21D hanya cocok dengan akun 210002, sehingga mengembalikkan 25. 210001 tidak cocok, karena saldonya adalah credit.

Pengecualian awalan dapat digabungkan dengan akhiran C dan D.

Example

21D + 10\(101, 102)C - 5\(57)
Formula ini menambahkan saldo dari baris-baris pergerakkan yang dibuat pada akun yang kodenya dimulai dengan 21 bila debit (D) dan menambahkan 10 bila kredit (C), tapi mengabaikan awalan 101, 102, dan mengurangi saldo dari akun dengan awalan 5, tapi mengabaikan awalan 57.

Untuk mencocokkan huruf C atau D di awalan dan tidak menggunakannya sebagai akhiran, gunakan pengecualian kosong ()`.

Example

21D\()
Formula ini mencocokkan akun yang kodenya dimulai dengan 21D, terlepas dari tanda saldo.

Di atas menggunakan awalan kode untuk mengikutsertakan akun, Anda juga dapat mencocokkan mereka dengan tag akun. Ini berguna terutama, sebagai contoh, bila negara Anda tidak memiliki standarisasi bagan akun, di mana awalan yang sama mungkin digunakan untuk tujuan yang berbeda di perusahaan.

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)
This formula matches accounts whose associated tags include the tag denoted by my_module.my_tag.

You can also use arithmetic expressions with tags, possibly combining them with prefix selections.

Example

tag(my_module.my_tag) + tag(42) + 10
The balances of accounts tagged as my_module.my_tag will be summed with those of accounts linked to the tag with ID 42 and accounts with the code prefix 10

C and D suffixes can be used in the same way with tags.

Example

tag(my_module.my_tag)C
This formula matches accounts with the tag my_module.my_tag and a credit balance.

Prefix exclusion also works with tags.

Example

tag(my_module.my_tag)\(10)
This formula matches accounts with the tag my_module.my_tag and a code not starting with 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.

Formulas can be one of the following:

sum

If the result must be the sum of all the external values in the period.

most_recent

If the result must be the value of the latest external value in the period.

In addition, subformulas can be used in two ways:

rounding=X

Replacing X with a number instructs to round the amount to X decimals.

editable

Indicates this expression can be edited manually, triggering the display of an icon in the report, allowing the user to perform this action.

Catatan

Manual values are created at the date_to currently selected in the report.

Both subformulas can be mixed by separating them with a ;.

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.

Kolom

Reports can have an indefinite number of columns to display. Each column gets its values from the expressions declared on the lines. The field expression_label of the column gives the label of the expressions whose value is displayed. If a line has no expression in that field, then nothing is displayed for it in this column. If multiple columns are required, you must use different expression labels.

Columns of report.

When using the period comparison feature found under the Options tab of an accounting report, all columns are repeated in and for each period.

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.

Catatan

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.

Tip

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.