Bỏ qua để đến Nội dung
Odoo Menu
  • Đăng nhập
  • Dùng thử miễn phí
  • Ứng dụng
    Tài chính
    • Kế toán
    • Hóa đơn
    • Chi phí
    • Bảng tính (BI)
    • Tài liệu
    • Ký tên
    Bán hàng
    • CRM
    • Bán hàng
    • POS Cửa hàng
    • POS Nhà hàng
    • Đăng ký
    • Cho thuê
    Trang web
    • Trình tạo trang web
    • Thương mại điện tử
    • Blog
    • Diễn đàn
    • Trò chuyện trực tiếp
    • Học trực tuyến
    Chuỗi cung ứng
    • Tồn kho
    • Sản xuất
    • PLM
    • Mua hàng
    • Bảo dưỡng
    • Chất lượng
    Nhân sự
    • Nhân viên
    • Tuyển dụng
    • Ngày nghỉ
    • Đánh giá
    • Giới thiệu
    • Đội xe
    Marketing
    • Marketing trên MXH
    • Marketing qua email
    • Marketing qua SMS
    • Sự kiện
    • Tự động hóa Marketing
    • Khảo sát
    Dịch vụ
    • Dự án
    • Bảng chấm công
    • Dịch vụ hiện trường
    • Hỗ trợ
    • Kế hoạch
    • Lịch hẹn
    Năng suất
    • Thảo luận
    • Phê duyệt
    • IoT
    • VoIP
    • Kiến thức
    • WhatsApp
    Ứng dụng của bên thứ ba Studio Odoo Nền tảng Đám mây Odoo
  • Ngành
    Bán lẻ
    • Nhà sách
    • Cửa hàng quần áo
    • Cửa hàng nội thất
    • Cửa hàng tạp hóa
    • Cửa hàng đồ kim khí
    • Cửa hàng đồ chơi
    Ẩm thực & Dịch vụ lưu trú
    • Bar và quán rượu
    • Nhà hàng
    • Đồ ăn nhanh
    • Guest house
    • Nhà phân phối đồ uống
    • Khách sạn
    Bất động sản
    • Công ty môi giới bất động sản
    • Công ty kiến trúc
    • Xây dựng
    • Quản lý bất động sản
    • Làm vườn
    • Hiệp hội chủ sở hữu bất động sản
    Tư vấn
    • Công ty kế toán
    • Đối tác Odoo
    • Công ty marketing
    • Công ty luật
    • Tuyển dụng
    • Thanh tra & chứng nhận
    Sản xuất
    • Dệt may
    • Kim loại
    • Nội thất
    • Ẩm thực
    • Nhà máy bia
    • Quà tặng doanh nghiệp
    Sức khoẻ & fitness
    • CLB thể thao
    • Cửa hàng kính mắt
    • Trung tâm fitness
    • Chuyên gia chăm sóc sức khỏe
    • Hiệu thuốc
    • Tiệm làm tóc
    Thương mại
    • Dịch vụ sửa chữa
    • Phần cứng CNTT & Hỗ trợ
    • Hệ thống năng lượng mặt trời
    • Công ty sản xuất giày
    • Dịch vụ vệ sinh
    • Dịch vụ HVAC
    Khác
    • Tổ chức phi lợi nhuận
    • Cơ quan môi trường
    • Cho thuê biển quảng cáo
    • Nhiếp ảnh
    • Cho thuê xe đạp
    • Đại lý phần mềm
    Xem tất cả ngành
  • Cộng đồng
    Học tập
    • Khóa học
    • Tài liệu
    • Chứng chỉ
    • Đào tạo
    • Blog
    • Podcast
    Thúc đẩy đào tạo
    • Chương trình đào tạo
    • Trò chơi kinh doanh Scale Up!
    • Tham quan Odoo
    Nhận phần mềm
    • Tải xuống
    • So sánh các phiên bản
    • Phiên bản
    Hợp tác
    • Github
    • Diễn đàn
    • Sự kiện
    • Dịch thuật
    • Trở thành đối tác
    • Dịch vụ dành cho Đối tác
    • Đăng ký công ty kế toán của bạn
    Nhận dịch vụ
    • Tìm đối tác
    • Tìm kế toán
    • Gặp chuyên gia hỗ trợ
    • Dịch vụ Triển khai
    • Khách hàng tham khảo
    • Hỗ trợ
    • Nâng cấp
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Nhận một buổi demo
  • Bảng giá
  • Trợ giúp

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Kế toán
  • Tồn kho
  • PoS
  • Dự án
  • MRP
All apps
Bạn cần phải đăng ký để tương tác với cộng đồng.
Tất cả bài viết Người Huy hiệu
Thẻ (Xem tất cả)
odoo accounting v14 pos v15
Về diễn đàn này
Bạn cần phải đăng ký để tương tác với cộng đồng.
Tất cả bài viết Người Huy hiệu
Thẻ (Xem tất cả)
odoo accounting v14 pos v15
Về diễn đàn này
Hỗ trợ

Help on adding page-break on qweb reports: where to put the tag?

Đăng ký nhận tin

Nhận thông báo khi có hoạt động trên bài viết này

Câu hỏi này đã bị gắn cờ
qwebpagesodoo12.0
1 Trả lời
35824 Lượt xem
Ảnh đại diện
Paulo Matos

Hello everyone.

I have the need to add a page-break on core Odoo invoice report report after a specific number of lines. Let's say 10 lines.

I have found several samples and information about which tags to use and how to use "if statements" for adding the page break, but unfortunately any of this samples help me because I do not know where to add the page-break tag.

I have found that the most used tags are:

<p style="page-break-before:always;"> </p> (most reports use this type)
<p style="page-break-after:always"></p>
<div style="page-break-after: auto;"><span style="display: none;"></span>
</div> <p style="page-break-inside: avoid"></p>
<div style="page-break-inside: auto"></div>

Also found that one can use "if statements" inside the "for each" loops with the help of counter variables. For instance:

<t t-foreach="o.line_ids" t-as="line">
    <t t-if="line_index == 13">
        <div style="page-break-after: always;"><br/></div>
    </t>
</t>

Ok. Everything seems to be very easy, but all tests I have made were unsuccessful.

The core Odoo invoice report already have the "<t t-foreach...":

The core report (part of it):

<t t-foreach="o.invoice_line_ids" t-as="line">
    <t t-set="current_subtotal" t-value="current_subtotal + line.price_subtotal" groups="account.group_show_line_subtotals_tax_excluded"/>
    <t t-set="current_subtotal" t-value="current_subtotal + line.price_total" groups="account.group_show_line_subtotals_tax_included"/>
    <tr t-att-class="'bg-200 font-weight-bold o_line_section' if line.display_type == 'line_section' else 'font-italic o_line_note' if line.display_type == 'line_note' else ''">
    <t t-if="not line.display_type" name="account_invoice_line_accountable">
        <td name="account_invoice_line_name"><span t-field="line.name"/></td>
        <td class="d-none"><span t-field="line.origin"/></td>
        <td class="text-right">
            <span t-field="line.quantity"/>
            <span t-field="line.uom_id" groups="uom.group_uom"/>
        </td>
        <td t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
            <span t-field="line.price_unit"/>
        </td>
        ...more code here
</t> #End of for loop here

On my understanding, Qweb starts the loop and for every line (record) it finds, it will add the <tr's> and <td's> based on table structure.

So, based on that, I have tried to use qweb variables and an if statement to increase a counter, and if the 10th value is reached, qweb adds a page break.

So I have tried:


<t t-set="counter" t-value="0" />

<t t-foreach="o.invoice_line_ids" t-as="line">

    <t t-if="counter == 10">
        <p style="page-break-before:always;"> </p>
    </t>
    <t t-set="counter" t-value="counter + 1" />
    
....here starts the core Odoo report data
    <t t-set="current_subtotal" t-value="current_subtotal + line.price_subtotal" groups="account.group_show_line_subtotals_tax_excluded"/>
    <t t-set="current_subtotal" t-value="current_subtotal + line.price_total" groups="account.group_show_line_subtotals_tax_included"/>
    <tr t-att-class="'bg-200 font-weight-bold o_line_section' if line.display_type == 'line_section' else 'font-italic o_line_note' if line.display_type == 'line_note' else ''">
    <t t-if="not line.display_type" name="account_invoice_line_accountable">
        <td name="account_invoice_line_name"><span t-field="line.name"/></td>
        <td class="d-none"><span t-field="line.origin"/></td>
        <td class="text-right">
            <span t-field="line.quantity"/>
            <span t-field="line.uom_id" groups="uom.group_uom"/>
        </td>
        <td t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
            <span t-field="line.price_unit"/>
        </td>
        ...more code here
</t> #End of for loop here

Using this approach it does not work and it adds a page break at the first page and the full report content (table header, rows and columns) goes to the second page.

Also tried to add the full code starting from the "foreach" inside the if condition and using this approach, I can only see the table header and cannot see the rows and columns...

Can anyone please send me a sample on where should I put this if condition in order to get the desired result? Break the page after the 10th invoice line?

Thank you all very much in advance

Best regards

PM


1
Ảnh đại diện
Huỷ bỏ
Jornald

I have same problem.How did you solve this?

Simon in Canada

Any luck in finding a solution for this?

Ảnh đại diện
Régis GEROMEGNACE
Câu trả lời hay nhất

Hello,

You must reinitialize your counter I think like this or use modulo if possible in qweb.

 

<t t-if="counter == 10">
<p style="page-break-before:always;"> </p>

<t t-set="counter" t-value="0"/>
</t>

<t t-set="counter" t-value="counter + 1" />

Regards,

4
Ảnh đại diện
Huỷ bỏ
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!

Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!

Đăng ký
Bài viết liên quan Trả lời Lượt xem Hoạt động
Replace the print option on top of form with a Print button. How can I achieve that? Đã xử lý
qweb reporting odoo12.0
Ảnh đại diện
Ảnh đại diện
1
thg 2 19
10587
Print payslip is not generating all pages - Working randomly
qweb payroll payslip odoo12.0
Ảnh đại diện
0
thg 5 19
2857
Expected singleton: hr.emp.travel.location(62, 63)
odoo12.0
Ảnh đại diện
Ảnh đại diện
Ảnh đại diện
2
thg 10 25
2098
Odoo 18: Display image from char field containing url in qweb form
qweb
Ảnh đại diện
Ảnh đại diện
1
thg 7 25
3115
PDF Export Option for QWeb Reports in odoo 17.0
qweb
Ảnh đại diện
Ảnh đại diện
1
thg 5 25
4089
Cộng đồng
  • Khóa học
  • Tài liệu
  • Diễn đàn
Open source
  • Tải xuống
  • Github
  • Runbot
  • Dịch thuật
Dịch vụ
  • Lưu trữ Odoo.sh
  • Hỗ trợ
  • Nâng cấp
  • Phát triển tùy chỉnh
  • Đào tạo
  • Tìm kế toán
  • Tìm đối tác
  • Trở thành đối tác
Giới thiệu công ty
  • Công ty của chúng tôi
  • Tài sản thương hiệu
  • Liên hệ
  • Việc làm
  • Sự kiện
  • Podcast
  • Blog
  • Khách hàng
  • Pháp lý • Riêng tư
  • Bảo mật
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo là bộ ứng dụng kinh doanh có open source đáp ứng tất cả các nhu cầu của công ty bạn: CRM, thương mại điện tử, kế toán, tồn kho, POS, quản lý dự án, v.v.

Định hướng giá trị riêng biệt của Odoo là tích hợp hoàn toàn và dễ dàng sử dụng.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now