Anpassade rapporter¶
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.
Viktigt
Activate the developer mode to access the accounting report configuration.
To create a new report, go to root report or a variant.
. From here, create either aTips
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.
Rotrapporter¶
Rotrapporter kan betraktas som generiska, neutrala redovisningsrapporter. De fungerar som modeller på vilka lokala bokföringsversioner byggs upp. Om en rapport inte har någon rotrapport, anses den själv vara en rotrapport.
Example
En skatterapport för Belgien och USA skulle båda använda samma generiska version som bas och anpassa den till sina nationella bestämmelser.
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 .
Observera
Fall som kräver att en ny rotrapport skapas är sällsynta, till exempel när ett lands skattemyndigheter kräver en ny och specifik typ av rapport.
Varianter¶
Varianter är landsspecifika versioner av rotrapporter och hänvisar därför alltid till en rotrapport. Om du vill skapa en variant väljer du en generisk rapport (rotrapport) i fältet Root Report när du skapar en ny rapport.
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.

Linjer¶
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.

Uttryck¶
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.
Observera
Beroende på motorn kan subformulas också krävas.
Odoo Domain computation engine¶
When using the Odoo Domain computation engine, a formula is interpreted as an Odoo
domain targeting account.move.line
objects.
Med hjälp av underformeln kan du definiera hur de flyttlinjer som matchar domänen används för att beräkna värdet på uttrycket:
summa
Resultatet är summan av alla saldon för de matchade flyttraderna.
summa_if_pos
Resultatet är summan av alla saldon för de matchade flyttraderna om detta belopp är positivt. I annat fall är det ”0”.
summa_om_neg
Resultatet är summan av alla saldon för de matchade flyttraderna om detta belopp är negativt. I annat fall är det ”0”.
räkna_rader
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.
Tips
To reverse the sign of the result, put a -
sign at the beginning of the subformula.

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).
Subformler kan vara något av följande:
if_above(CUR(belopp))
Värdet på det aritmetiska uttrycket returneras endast om det är större än den angivna gränsen. I annat fall blir resultatet
0
.if_below(CUR(belopp))
Värdet på det aritmetiska uttrycket returneras endast om det är lägre än den angivna gränsen. I annat fall blir resultatet
0
.if_between(CUR1(belopp1), CUR2(belopp2))
Värdet på det aritmetiska uttrycket returneras endast om det ligger strikt mellan de angivna gränserna. Annars kommer det att återföras till den närmaste gränsen.
if_other_expr_above(LINE_CODE.EXPRESSION_LABEL, CUR(amount))
Värdet på det aritmetiska uttrycket returneras endast om värdet på det uttryck som anges med den angivna radkoden och uttrycketiketten är större än den angivna gränsen. I annat fall blir resultatet
0
.if_other_expr_below(LINE_CODE.EXPRESSION_LABEL, CUR(amount))
Värdet på det aritmetiska uttrycket returneras endast om värdet på det uttryck som anges med den angivna radkoden och uttrycketiketten är lägre än den angivna gränsen. I annat fall blir resultatet
0
.
CUR
är valutakoden i versaler och belopp
är beloppet för den bundna betalningen uttryckt i den valutan.
Du kan också använda subformeln cross_report
för att matcha ett uttryck som finns i en annan rapport.
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
Example
21 + 10 - 5
21
och 10
och subtraherar saldot för dem på konton med prefixet 5
.Det är också möjligt att ignorera ett urval av subrefix.
Example
21 + 10\(101, 102) - 5\(57)
101
, 102
och 57
.Du kan tillämpa ”underfiltrering” på krediter och debiteringar med hjälp av suffixen C
och D
. I detta fall kommer ett konto endast att beaktas om dess prefix matchar, och om det totala saldot för de flyttrader som gjorts på detta konto är kredit/debit.
Example
Konto 210001
har ett saldo på -42 och konto 210002
har ett saldo på 25. Formeln 21D
matchar endast kontot 210002
och returnerar därför 25. 210001
matchas inte, eftersom dess saldo är kredit.
Prefixuteslutningar kan kombineras med suffixen C
och D
.
Example
21
om det är debet (D
) och 10
om det är kredit (C
), men ignorerar prefixen 101
, 102
, och subtraherar saldot för dem på konton med prefixet 5
, ignorerar prefixet 57
.För att matcha bokstaven C
eller D
i ett prefix och inte använda den som suffix, använd en tom uteslutning ()
.
Example
21D\()
Förutom att använda kodprefix för att inkludera konton kan du också matcha dem med kontotaggar. Detta är särskilt användbart om ditt land till exempel saknar en standardiserad kontoplan, där samma prefix kan användas för olika ändamål i olika företag.
Example
tag(25)
If the tag you reference is defined in a data file, an XMLID can be used instead of the ID.
Example
tag(min_modul.min_tag)
Du kan också använda aritmetiska uttryck med taggar och eventuellt kombinera dem med prefixval.
Example
tag(min_modul.min_tag) + tag(42) + 10
10
Suffixen C
och D
kan användas på samma sätt som taggar.
Example
tag(min_modul.min_tag)C
Prefixuteslutning fungerar också med taggar.
Example
tag(min_modul.min_tag)\(10)
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.
Formler kan vara en av följande:
summa
Om resultatet ska vara summan av alla externa värden under perioden.
most_recent
Om resultatet ska vara värdet av det senaste externa värdet under perioden.
Dessutom kan subformler användas på två sätt:
- avrundning=X
Om du ersätter ”X” med ett tal avrundas beloppet till X decimaler.
- ”redigerbar
Indikerar att detta uttryck kan redigeras manuellt, vilket utlöser visning av en ikon i rapporten som gör det möjligt för användaren att utföra denna åtgärd.
Observera
Manuella värden skapas vid det ”date_to” som för närvarande är valt i rapporten.
Båda delformlerna kan blandas genom att separera dem med ett ;
.
Example
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.
Kolumner¶
Rapporter kan ha ett obegränsat antal kolumner att visa. Varje kolumn får sina värden från de uttryck som deklareras på raderna. Fältet expression_label i kolumnen anger etiketten för de uttryck vars värde visas. Om en rad inte har något uttryck i det fältet visas ingenting för den i den här kolumnen. Om flera kolumner krävs måste du använda olika expression-etiketter.

När du använder funktionen periodjämförelse som finns under fliken Options i en redovisningsrapport, upprepas alla kolumner i och för varje 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.
Observera
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 (bug) icon, then click Fields. Click New to create a new field, and complete the following fields:
, and click theField 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.
Tips
To find a list of all the model’s fields and their technical names, go to (bug) icon, then click Fields. The technical name of each field is listed in the Field Name column.
, and click the