รายงานที่กำหนดเอง

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.

Important

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.

รายงานหลัก

รายงานหลักถือได้ว่าเป็นรายงานทางบัญชีทั่วไปที่เป็นกลาง ทำหน้าที่เป็นแบบจำลองที่สร้างเวอร์ชันการบัญชีท้องถิ่น หากรายงานไม่มีรายงานหลัก จะถือว่าเป็นรายงานหลักของรายงานนั้นๆ

Example

รายงานภาษีสำหรับประเทศเบลเยียมและสหรัฐอเมริกาจะใช้เวอร์ชันทั่วไปเดียวกันเป็นฐานและปรับให้เข้ากับกฎระเบียบภายในประเทศ

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.

Note

กรณีที่จำเป็นต้องสร้างรายงานหลักใหม่นั้นพบได้ยาก เช่น เมื่อหน่วยงานด้านภาษีของประเทศต้องการรายงานประเภทใหม่ที่เฉพาะเจาะจง

ตัวแปร

รูปแบบคือรายงานหลักในเวอร์ชันเฉพาะประเทศ ดังนั้นจึงอ้างอิงถึงรายงานหลักเสมอ หากต้องการสร้างรูปแบบ ให้เลือกรายงานทั่วไป (หลัก) ในช่อง รายงานหลัก เมื่อสร้างรายงานใหม่

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.

การเลือกรูปแบบรายงาน

รายการ

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.

ตัวเลือกบรรทัดกลไก

ตัวสั่งงาน

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.

Note

อาจจำเป็นต้องใช้ สูตรย่อย ทั้งนี้ขึ้นอยู่กับกลไก

Odoo Domain computation engine

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

สูตรย่อยช่วยให้คุณกำหนดวิธีการใช้เส้นย้ายที่ตรงกับโดเมนเพื่อคำนวณค่าของนิพจน์:

sum

ผลลัพธ์คือผลรวมของยอดคงเหลือทั้งหมดของเส้นการเคลื่อนไหวที่ตรงกัน

sum_if_pos

ผลลัพธ์คือผลรวมของยอดคงเหลือทั้งหมดของเส้นการเคลื่อนไหวที่ตรงกัน หากจำนวนนี้เป็นบวก ไม่เช่นนั้นจะเป็น 0

sum_if_neg

ผลลัพธ์คือผลรวมของยอดคงเหลือทั้งหมดของเส้นการเคลื่อนไหวที่ตรงกัน หากจำนวนเงินนี้เป็นลบ ไม่เช่นนั้นจะเป็น 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.

บรรทัดนิพจน์ภายในรายงานบรรทัด

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.

เมื่อประเมินนิพจน์ การคำนวณนิพจน์สามารถแสดงคร่าวๆ ได้เป็น: (จำนวนบรรทัดที่ย้ายด้วย + แท็ก) - (จำนวนบรรทัดที่ย้ายด้วย `- ` แท็ก).

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

สูตรย่อย อาจเป็นรายการใดรายการหนึ่งต่อไปนี้ได้

if_above(CUR(amount))

ค่าของนิพจน์ทางคณิตศาสตร์จะถูกส่งกลับก็ต่อเมื่อมีค่ามากกว่าขอบเขตที่ระบุเท่านั้น ไม่เช่นนั้นผลลัพธ์จะเป็น 0

if_below(CUR(amount))

ค่าของนิพจน์ทางคณิตศาสตร์จะถูกส่งกลับก็ต่อเมื่อค่านั้นต่ำกว่าขอบเขตที่ระบุเท่านั้น ไม่เช่นนั้นผลลัพธ์จะเป็น 0

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

ค่าของนิพจน์ทางคณิตศาสตร์จะถูกส่งกลับเฉพาะในกรณีที่ค่านั้นอยู่ระหว่างขอบเขตที่ระบุเท่านั้น ไม่เช่นนั้นจะถูกนำกลับมาสู่ขอบเขตที่ใกล้ที่สุด

if_other_expr_above(LINE_CODE.EXPRESSION_LABEL, CUR(amount))

ค่าของนิพจน์ทางคณิตศาสตร์จะถูกส่งกลับก็ต่อเมื่อค่าของนิพจน์ที่แสดงโดยโค้ดบรรทัดที่ให้ไว้และป้ายกำกับนิพจน์นั้นมากกว่าค่าขอบเขตที่ระบุ ไม่เช่นนั้นผลลัพธ์จะเป็น 0

if_other_expr_below(LINE_CODE.EXPRESSION_LABEL, CUR(amount))

ค่าของนิพจน์ทางคณิตศาสตร์จะถูกส่งกลับก็ต่อเมื่อค่าของนิพจน์ที่แสดงโดยโค้ดบรรทัดที่ให้ไว้และป้ายกำกับนิพจน์ต่ำกว่าขอบเขตที่ให้ไว้ ไม่เช่นนั้นผลลัพธ์จะเป็น 0

CUR คือรหัสสกุลเงินที่เป็นตัวพิมพ์ใหญ่ และ จำนวน คือจำนวนเงินที่ถูกผูกมัดซึ่งแสดงในสกุลเงินนั้น

คุณยังสามารถใช้สูตรย่อย cross_report เพื่อจับคู่นิพจน์ที่พบในรายงานอื่นได้

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 และ 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)
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)
สูตรนี้จับคู่บัญชีที่มีแท็กที่เกี่ยวข้องซึ่งมีแท็กที่แสดงโดย my_module.my_tag

คุณยังสามารถใช้นิพจน์ทางคณิตศาสตร์กับแท็ก ซึ่งอาจรวมกับการเลือกคำนำหน้าก็ได้

Example

tag(my_module.my_tag) + tag(42) + 10
ยอดคงเหลือของบัญชีที่ติดแท็กเป็น my_module.my_tag จะถูกรวมเข้ากับบัญชีที่เชื่อมโยงกับแท็กที่มี ID 42 และบัญชีที่มีรหัสนำหน้า 10

ส่วนต่อท้าย C และ D สามารถใช้ในลักษณะเดียวกันกับแท็กได้

Example

tag(my_module.my_tag)C
สูตรนี้จับคู่บัญชีที่มีแท็ก my_module.my_tag และยอดเครดิต

การยกเว้นคำนำหน้ายังใช้ได้กับแท็กอีกด้วย

Example

tag(my_module.my_tag)\(10)
สูตรนี้จับคู่บัญชีที่มีแท็ก my_module.my_tag และโค้ดที่ไม่ได้ขึ้นต้นด้วย 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.

สูตร สามารถเป็นหนึ่งในรายการต่อไปนี้:

sum

หากผลลัพธ์จะต้องเป็นผลรวมของค่าภายนอกทั้งหมดในช่วงเวลานั้น

most_recent

หากผลลัพธ์ต้องเป็นมูลค่าภายนอกล่าสุดในช่วงเวลานั้น

นอกจากนี้ สูตรย่อย ยังสามารถใช้ได้สองวิธี:

rounding=X

การแทนที่ X ด้วยตัวเลขจะแนะนำให้ปัดเศษจำนวนให้เป็นทศนิยม X

สามารถแก้ไขได้

บ่งชี้ว่านิพจน์สามารถแก้ไขได้ด้วยตนเอง โดยเรียกใช้การแสดงไอคอนในรายงาน ทำให้ผู้ใช้สามารถดำเนินการนี้ได้

Note

ค่าที่กำหนดเองจะถูกสร้างขึ้นที่ date_to ที่เลือกไว้ในรายงานในปัจจุบัน

สูตรย่อยทั้งสองสามารถผสมกันได้โดยแยกด้วยเครื่องหมาย ;

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.

คอลัมน์

รายงานสามารถมีคอลัมน์ที่จะแสดงได้ จำนวนไม่จำกัด แต่ละคอลัมน์จะได้รับค่าจาก นิพจน์ ที่ประกาศใน บรรทัด ฟิลด์ expression_label ของคอลัมน์จะให้ป้ายกำกับของนิพจน์ที่มีค่าที่แสดง หากบรรทัดไม่มี นิพจน์ ในช่องนั้น จะไม่มีอะไรแสดงในคอลัมน์นี้ หากจำเป็นต้องมีหลายคอลัมน์ คุณต้องใช้ป้ายกำกับ นิพจน์ ที่แตกต่างกัน

คอลัมน์รายงาน

เมื่อใช้ฟีเจอร์ การเปรียบเทียบช่วงเวลา ที่พบในแท็บ ตัวเลือก ของรายงานทางบัญชี คอลัมน์ทั้งหมดจะถูกทำซ้ำในแต่ละช่วงเวลา

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.

Note

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.