Báo cáo tùy chỉnh:¶
Odoo comes with a powerful and easy-to-use reporting framework. The engine allows you to create new reports, such as tax reports, or balance sheets and income statements with specific groupings and layouts.
Quan trọng
Activate the developer mode to access the accounting report creation interface.
To create a new report, open the Accounting app and navigate to . From here, you can either create a root report or a variant.
Báo cáo gốc¶
Báo cáo gốc có thể được coi là các báo cáo kế toán chung, trung lập. Chúng đóng vai trò là mẫu mà trên đó các phiên bản kế toán địa phương được xây dựng. Nếu một báo cáo không có báo cáo gốc, nó được coi là báo cáo gốc.
Example
Báo cáo thuế cho Bỉ và Mỹ đều sử dụng cùng một phiên bản chung làm cơ sở và điều chỉnh nó cho các quy định trong nước của họ.
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 .
Ghi chú
Các trường hợp yêu cầu tạo báo cáo gốc mới rất hiếm, chẳng hạn như khi cơ quan thuế của một quốc gia yêu cầu một loại báo cáo mới và cụ thể.
Biến thể¶
Các biến thể là phiên bản cụ thể theo quốc gia của báo cáo gốc và do đó luôn tham chiếu đến một báo cáo gốc. Để tạo một biến thể, hãy chọn một báo cáo chung (gốc) trong trường Báo cáo gốc khi tạo báo cáo mới.
When a root report is opened from one of the accounting app's main menus, all its variants are displayed in the variant selector in the top right corner of the view.
Example
In the following image, VAT Report (BE) is the variant of the root Generic Tax report.
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.
Biểu thức¶
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.
Ghi chú
Tùy thuộc vào động cơ, công thức phụ cũng có thể được yêu cầu.
'Odoo Domain' engine¶
With this engine, a formula is interpreted as an Odoo domain
targeting account.move.line objects.
Công thức phụ cho phép bạn xác định cách các dòng di chuyển khớp với miền được sử dụng để tính toán giá trị của biểu thức:
sumKết quả là tổng của tất cả các số dư của các dòng di chuyển phù hợp.
sum_if_posKết quả là tổng của tất cả các số dư của các dòng di chuyển phù hợp nếu số tiền này là dương. Nếu không, nó là
0.sum_if_negKết quả là tổng của tất cả các số dư của các dòng di chuyển phù hợp nếu số tiền này là âm. Nếu không, nó là
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.
You can also put a - sign at the beginning of the subformula to reverse the sign of the
result.
'Aggregate Other Formulas' engine¶
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).
Các công thức phụ có thể là một trong các loại sau:
if_above(CUR(amount))Giá trị của biểu thức số học sẽ chỉ được trả về nếu nó lớn hơn giới hạn đã cung cấp. Nếu không, kết quả sẽ là
0.if_below(CUR(amount))Giá trị của biểu thức số học sẽ chỉ được trả về nếu nó nhỏ hơn giới hạn đã cung cấp. Nếu không, kết quả sẽ là
0.if_between(CUR1(amount1), CUR2(amount2))Giá trị của biểu thức số học sẽ chỉ được trả về nếu nó nằm chặt chẽ giữa các giới hạn đã cung cấp. Nếu không, nó sẽ được đưa về giới hạn gần nhất.
if_other_expr_above(LINE_CODE.EXPRESSION_LABEL, CUR(amount))Giá trị của biểu thức số học sẽ chỉ được trả về nếu giá trị của biểu thức được chỉ định bởi mã dòng và nhãn biểu thức đã cung cấp lớn hơn giới hạn đã cho. Nếu không, kết quả sẽ là
0.if_other_expr_below(LINE_CODE.EXPRESSION_LABEL, CUR(amount))Giá trị của biểu thức số học sẽ chỉ được trả về nếu giá trị của biểu thức được chỉ định bởi mã dòng và nhãn biểu thức đã cung cấp nhỏ hơn giới hạn đã cho. Nếu không, kết quả sẽ là
0.
CUR là mã tiền tệ viết hoa, và amount là số tiền của giới hạn được biểu thị bằng loại tiền tệ đó.
cross_report(xml_id | report_id)Được sử dụng để khớp một biểu thức từ một báo cáo khác được chỉ định bởi xml_id hoặc chính ID báo cáo.
'Prefix of Account Codes' engine¶
This engine is used to match amounts made on accounts using the prefixes of these accounts' codes as variables in an arithmetic expression.
Example
21Example
21 + 10 - 521 và 10, và trừ đi số dư của các tài khoản có tiền tố 5.Cũng có thể bỏ qua một lựa chọn các tiền tố phụ.
Example
21 + 10\(101, 102) - 5\(57)101, 102 và 57.Bạn có thể áp dụng 'lọc phụ' trên thẻ tín dụng và nợ bằng cách sử dụng hậu tố C và D. Trong trường hợp này, một tài khoản chỉ được xem xét nếu tiền tố của nó khớp với, và nếu tổng số dư của các dòng bút toán được thực hiện trên tài khoản này là thẻ tín dụng/nợ.
Example
Tài khoản 210001 có số dư là -42 và tài khoản 210002 có số dư là 25. Công thức 21D chỉ khớp với tài khoản 210002, và do đó trả về 25. 210001 không khớp vì số dư của nó là thẻ tín dụng.
Loại trừ tiền tố có thể kết hợp với hậu tố C và D.
Example
21D + 10\(101, 102)C - 5\(57)21 nếu nó là nợ (D) và 10 nếu nó là thẻ tín dụng (C), nhưng bỏ qua các tiền tố 101, 102, và trừ đi số dư của các tài khoản có tiền tố 5, bỏ qua tiền tố 57.Để khớp với chữ C hoặc D trong tiền tố và không sử dụng nó như hậu tố, hãy sử dụng loại trừ trống ().
Example
21D\()21D, bất kể dấu số dư của chúng.Ngoài việc sử dụng tiền tố mã để bao gồm các tài khoản, bạn cũng có thể khớp chúng bằng thẻ tài khoản. Điều này đặc biệt hữu ích, ví dụ như, nếu quốc gia của bạn thiếu một hệ thống kế toán chuẩn hóa, nơi mà cùng một tiền tố có thể được sử dụng cho các mục đích khác nhau giữa các công ty.
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(my_module.my_tag)Bạn cũng có thể sử dụng biểu thức số học với thẻ, có thể kết hợp chúng với lựa chọn tiền tố.
Example
tag(my_module.my_tag) + tag(42) + 1010Hậu tố C và D có thể được sử dụng theo cách tương tự với thẻ.
Example
tag(my_module.my_tag)CLoại trừ tiền tố cũng hoạt động với thẻ.
Example
tag(my_module.my_tag)\(10)10.'External Value' engine¶
The 'external value' 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.
Công thức có thể là một trong những loại sau:
sumNếu kết quả phải là tổng của tất cả các giá trị bên ngoài trong kỳ.
most_recentNếu kết quả phải là giá trị của giá trị bên ngoài mới nhất trong kỳ.
Ngoài ra, công thức con có thể được sử dụng theo hai cách:
rounding=XThay thế
Xbằng một số hướng dẫn làm tròn số tiền đến X chữ số thập phân.có thể chỉnh sửaCho biết biểu thức này có thể được chỉnh sửa thủ công, kích hoạt hiển thị biểu tượng trong báo cáo, cho phép người dùng thực hiện hành động này.
Ghi chú
Các giá trị thủ công được tạo tại date_to hiện đang được chọn trong báo cáo.
Cả hai công thức con có thể được kết hợp bằng cách phân tách chúng bằng dấu ;.
Example
editable;rounding=2'Custom Python Function' engine¶
This 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 it only if you are making a custom module of your own.
Cột¶
Báo cáo có thể có số lượng cột không giới hạn để hiển thị. Mỗi cột nhận giá trị từ các biểu thức được khai báo trên dòng. Trường expression_label của cột cung cấp nhãn cho các biểu thức có giá trị được hiển thị. Nếu một dòng không có biểu thức trong trường đó, thì không có gì được hiển thị cho nó trong cột này. Nếu cần nhiều cột, bạn phải sử dụng các nhãn biểu thức khác nhau.
Khi sử dụng tính năng so sánh kỳ được tìm thấy trong tab Tùy chọn của báo cáo kế toán, tất cả các cột được lặp lại trong và cho mỗi kỳ.
Nhóm dòng¶
Nhóm không chuẩn có thể thực hiện bằng cách thêm hoặc sử dụng các trường hiện có trên mô hình Bút toán, với điều kiện các trường đó có liên quan và không được lưu trữ.
Ghi chú
Nhóm các dòng yêu cầu báo cáo phải có các dòng báo cáo rõ ràng có thể chỉnh sửa được. Ví dụ, các báo cáo hoãn lại không hỗ trợ nhóm dòng vì chúng sử dụng các dòng động được tạo ra.
Tạo trường mới trên bút toán¶
Để tạo một trường liên quan không lưu trữ trong mô hình Bút toán, đầu tiên hãy đi tới và nhấp vào biểu tượng (bug), sau đó nhấp vào Trường. Nhấp vào Mới để tạo trường mới và hoàn thành các trường sau:
Tên trường: tên kỹ thuật cho trường
Nhãn trường: nhãn sẽ được hiển thị cho trường
Loại trường: loại trường mà trường liên quan này sẽ trỏ tới
Đã lưu trữ: Để trống trường này vì chỉ các trường không lưu trữ mới có thể được sử dụng để nhóm các dòng.
Mô hình liên quan: Nếu loại trường là one2many, many2many hoặc many2one, hãy chọn mô hình của trường gốc để nhóm theo.
Định nghĩa trường liên quan: đường dẫn kỹ thuật đến trường bạn muốn nhóm theo
Example
Để nhóm theo nhóm bán hàng của đối tác thương mại, hãy đặt định nghĩa trường liên quan là
move_id.team_id.
Nhóm các dòng¶
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.
Mẹo
Để tìm danh sách tất cả các trường của mô hình và tên kỹ thuật của chúng, hãy đi tới và nhấp vào biểu tượng (bug), sau đó nhấp vào Trường. Tên kỹ thuật của mỗi trường được liệt kê trong cột Tên trường.
Custom tax report setup¶
Report configuration¶
Mẹo
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.
Mẹo
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.
Xem thêm