Resoconti personalizzati

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.

Importante

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.

Suggerimento

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

Resoconti radice

I resoconti radice sono resoconti contabili generici e neutrali che fungono da modelli per costruire le versioni locali. Se un resoconto non presenta un resoconto radice viene considerato esso stesso un resoconto radice.

Example

Un resoconto fiscale per il Belgio e gli Stati Uniti utilizzerebbe la stessa versione generica come base e la adatterebbe alle rispettive normative nazionali.

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.

Nota

I casi che richiedono la creazione di un nuovo resoconto sono rari, come ad esempio quando le autorità fiscali di un Paese richiedono un nuovo e specifico tipo di resoconto.

Varianti

Le varianti sono versioni specifiche per Paese dei resoconti radice e, pertanto, fanno sempre riferimento a un resoconto radice. Per creare una variante, selezionare un resoconto generico (radice) nel campo Resoconto radice quando crei un nuovo resoconto.

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.

Selezione variante resoconto.

Righe

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.

Opzioni righe motore.

Espressioni

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.

Nota

In base al motore, potrebbero essere richieste anche formule secondarie.

Odoo Domain computation engine

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

La formula secondaria consente di definire il modo in cui le righe di spostamento corrispondenti al dominio vengono utilizzate per calcolare il valore dell’espressione:

sum

Il risultato è la somma di tutti i saldi delle righe di movimento abbinate.

sum_if_pos

Il risultato è la somma di tutti i saldi delle righe movimento abbinate se l’importo è positivo. Altrimenti, è pari a 0.

sum_if_neg

Il risultato è la somma di tutti i saldi delle righe movimento abbinate se l’importo è negativo. Altrimenti, è pari a 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.

Suggerimento

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

Riga espressione all'interno di un resoconto

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.

Quando si valuta l’espressione, il calcolo dell’espressione può essere approssimativamente espresso come: (numero righe di movimento con + tag) - (numero righe di movimento con - 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).

Di seguito, un elenco delle principali formule secondarie:

if_above(CUR(amount))

Il valore dell’espressione aritmetica viene restituito solo se è maggiore del limite fornito. Altrimenti, il risultato sarà 0.

if_below(CUR(amount))

Il valore dell’espressione aritmetica viene restituito solo se è inferiore al limite fornito. Altrimenti, il risultato sarà 0.

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

Il valore dell’espressione aritmetica viene restituito solo se è strettamente compreso tra i limiti forniti. In caso contrario, verrà riportato al limite più vicino.

if_other_expr_above(LINE_CODE.EXPRESSION_LABEL, CUR(amount))

Il valore dell’espressione aritmetica verrà restituito solo se il valore dell’espressione denotata dal codice di riga e dall’etichetta di espressione forniti è maggiore del limite fornito. Altrimenti, il risultato sarà 0.

if_other_expr_below(LINE_CODE.EXPRESSION_LABEL, CUR(amount))

Il valore dell’espressione aritmetica verrà restituito solo se il valore dell’espressione denotata dal codice di riga e dall’etichetta di espressione forniti è inferiore al limite fornito. Altrimenti, il risultato sarà 0.

CUR corrisponde al codice valuta in maiuscolo e amount è l’importo del limite espresso in quella valuta.

Puoi utilizzare anche la formula secondaria cross_report per abbinare un’espressione trovata in un altro resoconto.

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
Le espressioni aritmetiche possono essere composte anche da un singolo prefisso, come in questo caso.

Example

21 + 10 - 5
Questa formula somma i saldi delle righe di movimento effettuate sui conti i cui codici iniziano con 21 e 10, e sottrae il saldo di quelle sui conti con il prefisso 5.

È anche possibile ignorare la selezione di prefissi secondari.

Example

21 + 10\(101, 102) - 5\(57)
Questa formula funziona come l’esempio precedente, ma ignora i prefissi 101, 102 e 57.

È possibile applicare un “sottofiltraggio” su crediti e debiti utilizzando i suffissi C e D. In questo caso, un conto verrà considerato solo se il suo prefisso corrisponde, e se il saldo totale delle righe di movimento effettuate su questo conto è credito/debito.

Example

Il conto 210001 ha un saldo di -42 e il conto 210002 ha un saldo di 25. La formula 21D corrisponde solo al conto 210002, e quindi restituisce 25. Il conto 210001 non viene abbinato, poiché il suo saldo è a credito.

Le esclusioni del prefisso possono essere mescolate con i suffissi C e D.

Example

21D + 10\(101, 102)C - 5\(57)
Questa formula somma i saldi delle righe di movimento effettuate sui conti il cui codice inizia con 21 se è a debito (D) e 10 se è a credito (C), ma ignora i prefissi 101, 102, e sottrae il saldo di quelle sui conti con il prefisso 5, ignorando il prefisso 57.

Per abbinare la lettera C o D in un prefisso e non utilizzarla come suffisso, utilizza un’esclusione vuota ().

Example

21D\()
Questa formula corrisponde ai conti il cui codice inizia con 21D, indipendentemente dal segno del saldo.

Oltre a utilizzare i prefissi dei codici per includere i conti, è possibile abbinarli a tag conto. Questo è particolarmente utile, ad esempio, se nel tuo Paese non esiste un piano dei conti standardizzato, dove lo stesso prefisso potrebbe essere usato per scopi diversi da un’azienda all’altra.

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)
Questa formula corrisponde ai conti i cui tag associati includo il tag indicato con my_module.my_tag.

È inoltre possibile utilizzare espressioni aritmetiche con i tag, eventualmente combinandole con selezioni di prefissi.

Example

tag(my_module.my_tag) + tag(42) + 10
I saldi dei conti etichettati come my_module.my_tag saranno sommati a quelli dei conti collegati al tag con ID 42 e dei conti con prefisso 10.

I suffissi C e D possono essere utilizzati allo stesso modo con i tag.

Example

tag(my_module.my_tag)C
Questa formula corrisponde ai conti con il tag my_module.my_tag e un saldo attivo.

L’esclusione dei prefissi funziona anche con i tag.

Example

tag(my_module.my_tag)\(10)
Questa formula corrisponde ai conti con il tag my_module.my_tag e un codice che non inizia con 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.

Le formule utilizzabili sono:

sum

Se il risultato deve essere la somma di tutti i valori esterni nel periodo.

most_recent

Se il risultato deve essere il valore dell’ultimo valore esterno nel periodo.

Inoltre, le formule secondarie possono essere usate in due modi:

rounding=X

La sostituzione di X con un numero indica l’arrotondamento dell’importo a X decimali.

editable

Indica che questa espressione può essere modificata manualmente, attivando la visualizzazione di un’icona nel resoconto, che consente all’utente di eseguire questa azione.

Nota

I valori manuali vengono creati nella data date_to attualmente selezionata nel resoconto.

Entrambe le formule secondarie possono essere mescolate separandole con un ;.

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.

Colonne

I resoconti possono avere un numero indefinito di colonne da visualizzare. Ogni colonna ottiene i suoi valori dalle espressioni dichiarate sulle righe. Il campo expression_label della colonna fornisce l’etichetta delle espressioni il cui valore viene visualizzato. Se una riga non ha alcuna espressione in quel campo, non viene visualizzato nulla in questa colonna. Se sono necessarie più colonne, è necessario utilizzare etichette di espressione diverse.

Colonne del resoconto.

Quando si utilizza la funzione di confronto tra periodi presente nella scheda Opzioni di un rendiconto contabile, tutte le colonne vengono ripetute in e per ogni periodo.

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.

Nota

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.

Suggerimento

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.