รายงานที่กำหนดเอง¶
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.
Important
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.
รายงานหลัก¶
รายงานหลักถือได้ว่าเป็นรายงานทางบัญชีทั่วไปที่เป็นกลาง ทำหน้าที่เป็นแบบจำลองที่สร้างเวอร์ชันการบัญชีท้องถิ่น หากรายงานไม่มีรายงานหลัก จะถือว่าเป็นรายงานหลักของรายงานนั้นๆ
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 .
Note
กรณีที่จำเป็นต้องสร้างรายงานหลักใหม่นั้นพบได้ยาก เช่น เมื่อหน่วยงานด้านภาษีของประเทศต้องการรายงานประเภทใหม่ที่เฉพาะเจาะจง
ตัวแปร¶
รูปแบบคือรายงานหลักในเวอร์ชันเฉพาะประเทศ ดังนั้นจึงอ้างอิงถึงรายงานหลักเสมอ หากต้องการสร้างรูปแบบ ให้เลือกรายงานทั่วไป (หลัก) ในช่อง รายงานหลัก เมื่อสร้างรายงานใหม่
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.
ตัวสั่งงาน¶
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.
Note
อาจจำเป็นต้องใช้ สูตรย่อย ทั้งนี้ขึ้นอยู่กับกลไก
'Odoo Domain' engine¶
With this engine, a formula is interpreted as an Odoo domain
targeting account.move.line objects.
สูตรย่อยช่วยให้คุณกำหนดวิธีการใช้เส้นย้ายที่ตรงกับโดเมนเพื่อคำนวณค่าของนิพจน์:
sumผลลัพธ์คือผลรวมของยอดคงเหลือทั้งหมดของเส้นการเคลื่อนไหวที่ตรงกัน
sum_if_posผลลัพธ์คือผลรวมของยอดคงเหลือทั้งหมดของเส้นการเคลื่อนไหวที่ตรงกัน หากจำนวนนี้เป็นบวก ไม่เช่นนั้นจะเป็น
0sum_if_negผลลัพธ์คือผลรวมของยอดคงเหลือทั้งหมดของเส้นการเคลื่อนไหวที่ตรงกัน หากจำนวนเงินนี้เป็นลบ ไม่เช่นนั้นจะเป็น
0count_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).
สูตรย่อย อาจเป็นรายการใดรายการหนึ่งต่อไปนี้ได้
if_above(CUR(amount))ค่าของนิพจน์ทางคณิตศาสตร์จะถูกส่งกลับก็ต่อเมื่อมีค่ามากกว่าขอบเขตที่ระบุเท่านั้น ไม่เช่นนั้นผลลัพธ์จะเป็น
0if_below(CUR(amount))ค่าของนิพจน์ทางคณิตศาสตร์จะถูกส่งกลับก็ต่อเมื่อค่านั้นต่ำกว่าขอบเขตที่ระบุเท่านั้น ไม่เช่นนั้นผลลัพธ์จะเป็น
0if_between(CUR1(amount1), CUR2(amount2))ค่าของนิพจน์ทางคณิตศาสตร์จะถูกส่งกลับเฉพาะในกรณีที่ค่านั้นอยู่ระหว่างขอบเขตที่ระบุเท่านั้น ไม่เช่นนั้นจะถูกนำกลับมาสู่ขอบเขตที่ใกล้ที่สุด
if_other_expr_above(LINE_CODE.EXPRESSION_LABEL, CUR(amount))ค่าของนิพจน์ทางคณิตศาสตร์จะถูกส่งกลับก็ต่อเมื่อค่าของนิพจน์ที่แสดงโดยโค้ดบรรทัดที่ให้ไว้และป้ายกำกับนิพจน์นั้นมากกว่าค่าขอบเขตที่ระบุ ไม่เช่นนั้นผลลัพธ์จะเป็น
0if_other_expr_below(LINE_CODE.EXPRESSION_LABEL, CUR(amount))ค่าของนิพจน์ทางคณิตศาสตร์จะถูกส่งกลับก็ต่อเมื่อค่าของนิพจน์ที่แสดงโดยโค้ดบรรทัดที่ให้ไว้และป้ายกำกับนิพจน์ต่ำกว่าขอบเขตที่ให้ไว้ ไม่เช่นนั้นผลลัพธ์จะเป็น
0
CUR คือรหัสสกุลเงินที่เป็นตัวพิมพ์ใหญ่ และ จำนวน คือจำนวนเงินที่ถูกผูกมัดซึ่งแสดงในสกุลเงินนั้น
cross_report(xml_id | report_id)ใช้เพื่อจับคู่นิพจน์จากรายงานอื่นที่กำหนดโดย xml_id หรือ ID ของรายงานเอง
'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 และ 10 และลบยอดคงเหลือในบัญชีที่มีคำนำหน้า 5นอกจากนี้ยังสามารถละเว้นการเลือกคำนำหน้าย่อยได้ด้วย
Example
21 + 10\(101, 102) - 5\(57)101, 102 และ 57คุณสามารถใช้ 'การกรองย่อย' กับ เครดิตและเดบิต โดยใช้ส่วนต่อท้าย C และ D ในกรณีนี้ บัญชีจะได้รับการพิจารณาก็ต่อเมื่อคำนำหน้าตรงกัน และ หากยอดรวมของรายการย้ายที่ทำในบัญชีนี้คือ เครดิต/เดบิต
Example
บัญชี 210001 มียอดคงเหลือ -42 และบัญชี 210002 มียอดคงเหลือ 25 สูตร 21D จะตรงกับบัญชี 210002 เท่านั้น และด้วยเหตุนี้จึงส่งคืน 25 210001 จะไม่ตรงกัน เนื่องจากยอดคงเหลืออยู่ที่ เครดิต
การยกเว้นคำนำหน้าสามารถผสมกับคำต่อท้าย "C" และ "D" ได้
Example
21D + 10\(101, 102)C - 5\(57)21 ถ้า เป็นเดบิต (D) และ 10 ถ้า เป็นเครดิต (C) แต่ไม่สนใจคำนำหน้า ` 101`, 102 และลบยอดเงินคงเหลือในบัญชีด้วยคำนำหน้า 5 โดยไม่สนใจคำนำหน้า 57หากต้องการจับคู่ตัวอักษร C หรือ D ในคำนำหน้าและไม่ใช้เป็นคำต่อท้าย ให้ใช้การยกเว้นว่าง ()
Example
21D\()21D โดยไม่คำนึงถึงเครื่องหมายยอดคงเหลือนอกจากการใช้คำนำหน้าโค้ดเพื่อรวมบัญชีแล้ว คุณยังสามารถจับคู่บัญชีเหล่านั้นกับ แท็กบัญชี ได้อีกด้วย สิ่งนี้มีประโยชน์อย่างยิ่ง ตัวอย่างเช่น หากประเทศของคุณไม่มีผังบัญชีที่เป็นมาตรฐาน ซึ่งอาจมีการใช้คำนำหน้าเดียวกันเพื่อวัตถุประสงค์ที่แตกต่างกันระหว่างบริษัทต่างๆ
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)คุณยังสามารถใช้นิพจน์ทางคณิตศาสตร์กับแท็ก ซึ่งอาจรวมกับการเลือกคำนำหน้าก็ได้
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'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.
สูตร สามารถเป็นหนึ่งในรายการต่อไปนี้:
sumหากผลลัพธ์จะต้องเป็นผลรวมของค่าภายนอกทั้งหมดในช่วงเวลานั้น
most_recentหากผลลัพธ์ต้องเป็นมูลค่าภายนอกล่าสุดในช่วงเวลานั้น
นอกจากนี้ สูตรย่อย ยังสามารถใช้ได้สองวิธี:
rounding=Xการแทนที่
Xด้วยตัวเลขจะแนะนำให้ปัดเศษจำนวนให้เป็นทศนิยม Xสามารถแก้ไขได้บ่งชี้ว่านิพจน์สามารถแก้ไขได้ด้วยตนเอง โดยเรียกใช้การแสดงไอคอนในรายงาน ทำให้ผู้ใช้สามารถดำเนินการนี้ได้
Note
ค่าที่กำหนดเองจะถูกสร้างขึ้นที่ date_to ที่เลือกไว้ในรายงานในปัจจุบัน
สูตรย่อยทั้งสองสามารถผสมกันได้โดยแยกด้วยเครื่องหมาย ;
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.
คอลัมน์¶
รายงานสามารถมีคอลัมน์ที่จะแสดงได้ จำนวนไม่จำกัด แต่ละคอลัมน์จะได้รับค่าจาก นิพจน์ ที่ประกาศใน บรรทัด ฟิลด์ expression_label ของคอลัมน์จะให้ป้ายกำกับของนิพจน์ที่มีค่าที่แสดง หากบรรทัดไม่มี นิพจน์ ในช่องนั้น จะไม่มีอะไรแสดงในคอลัมน์นี้ หากจำเป็นต้องมีหลายคอลัมน์ คุณต้องใช้ป้ายกำกับ นิพจน์ ที่แตกต่างกัน
เมื่อใช้ฟีเจอร์ การเปรียบเทียบช่วงเวลา ที่พบในแท็บ ตัวเลือก ของรายงานทางบัญชี คอลัมน์ทั้งหมดจะถูกทำซ้ำในแต่ละช่วงเวลา
การจัดกลุ่มบรรทัด¶
การจัดกลุ่มที่ไม่ได้มาตรฐานสามารถทำได้โดยการเพิ่มหรือใช้ฟิลด์ที่มีอยู่ในโมเดล รายการสมุดรายวัน โดยกำหนดว่าฟิลด์เหล่านั้นเป็นแบบเชื่อมโยงและไม่ได้เก็บไว้
Note
การจัดกลุ่มบรรทัดต้องการให้รายงานมีบรรทัดรายงานที่ชัดเจนซึ่งสามารถแก้ไขได้ ตัวอย่างเช่น รายงานรอตัดบัญชีไม่รองรับการจัดกลุ่มบรรทัดเนื่องจากใช้บรรทัดแบบไดนามิกที่สร้างขึ้น
สร้างฟิลด์ใหม่ในรายการสมุดรายวัน¶
หากต้องการสร้างฟิลด์ที่ไม่ได้เก็บไว้และเชื่อมโยงในโมเดล รายการสมุดรายวัน ให้ไปที่ ก่อน และคลิกไอคอน (บั๊ก) จากนั้นคลิก ฟิลด์ คลิก สร้าง เพื่อสร้างฟิลด์ใหม่ และกรอกข้อมูลในฟิลด์ต่อไปนี้:
ชื่อฟิลด์: ชื่อทางเทคนิคสำหรับฟิลด์
ป้ายกำกับฟิลด์: ป้ายกำกับที่จะแสดงสำหรับฟิลด์
ประเภทฟิลด์: ประเภทของฟิลด์ที่ฟิลด์ที่เกี่ยวข้องนี้ควรชี้ไปที่
จัดเก็บ: ปล่อยฟิลด์นี้ไว้โดยไม่ทำเครื่องหมายเนื่องจากสามารถใช้เฉพาะฟิลด์ที่ไม่ได้จัดเก็บเพื่อจัดกลุ่มรายการได้
โมเดลที่เกี่ยวข้อง: หากประเภทฟิลด์เป็น one2many, many2many หรือ many2one ให้เลือกโมเดลของฟิลด์เดิมที่จะจัดกลุ่มตาม
คำจำกัดความฟิลด์ที่เกี่ยวข้อง: เส้นทางทางเทคนิคไปยังฟิลด์ที่คุณต้องการจัดกลุ่มตาม
Example
หากต้องการจัดกลุ่มตามทีมขายของพาร์ทเนอร์เชิงพาณิชย์ ให้ตั้งค่าคำจำกัดความฟิลด์ที่เกี่ยวข้องเป็น
move_id.team_id
จัดกลุ่มรายการ¶
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
หากต้องการค้นหารายการฟิลด์ทั้งหมดของโมเดลและชื่อทางเทคนิค ให้ไปที่ และคลิกไอคอน (bug) จากนั้นคลิก ฟิลด์ ชื่อทางเทคนิคของแต่ละฟิลด์จะแสดงในคอลัมน์ ชื่อฟิลด์
ดูเพิ่มเติม
Custom tax report setup¶
Report configuration¶
Tip
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.
Tip
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.
ดูเพิ่มเติม