Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

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

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

Customize Report problem

Naroči se

Get notified when there's activity on this post

This question has been flagged
pdf
3 Odgovori
1544 Prikazi
Avatar
Jitesh Jeram

Hi,

I have inserted new columns into the pdf quote

  • Now two of the other coloumns are not printing correctly.
  • I also need to get the numbers all looking the same, besides the discount column.

https://ibb.co/C5kcZGMK


Current Code:

<data>

  <data>

    <xpath position="inside" expr="/t[@t-name='sale.report_saleorder_document_copy_1']//t[@t-call='web.external_layout']/div/div" meta-class="oe_structure">

      <br/>

    </xpath>

  </data>

  <data>

    <xpath position="inside" expr="/t[@t-name='sale.report_saleorder_document_copy_1']//t[@t-call='web.external_layout']/div/div[3]" meta-class="oe_structure">

      <br/>

    </xpath>

  </data>

  <data>

    <xpath position="replace" expr="/t[@t-name='sale.report_saleorder_document_copy_1']//t[@t-call='web.external_layout']/div/table/thead/tr/th[@name='th_taxes']" meta-name="th_taxes" meta-class="text-end"/>

    <xpath position="after" expr="/t[@t-name='sale.report_saleorder_document_copy_1']//t[@t-call='web.external_layout']/div/table/thead/tr/th[@name='th_discount']" meta-name="th_discount" meta-t-if="display_discount" meta-class="text-end">

      <th class="text-center"> Price Excl

      </th>

      <th name="th_taxes" class="text-center">VAT</th>

    </xpath>

  </data>

  <data>

    <xpath position="replace" expr="/t[@t-name='sale.report_saleorder_document_copy_1']//t[@t-call='web.external_layout']//th[@name='th_quantity']" meta-name="th_quantity" meta-class="text-end">

      <th name="th_quantity" class="text-end" style="text-align: center;">Qty</th>

    </xpath>

  </data>

  <data>

    <xpath position="replace" expr="/t[@t-name='sale.report_saleorder_document_copy_1']//t[@t-call='web.external_layout']//th[@name='th_subtotal']/span"/>

    <xpath position="inside" expr="/t[@t-name='sale.report_saleorder_document_copy_1']//t[@t-call='web.external_layout']//th[@name='th_subtotal']" meta-name="th_subtotal" meta-class="text-end">

      <span class="text-center">Price Incl</span>

      <br/>

    </xpath>

  </data>

  <data>

    <xpath position="replace" expr="/t[@t-name='sale.report_saleorder_document_copy_1']//t[@t-call='web.external_layout']/div/table/tbody/t[2]/tr/t/td[@name='td_quantity']" meta-name="td_quantity" meta-class="text-end text-nowrap"/>

    <xpath position="after" expr="/t[@t-name='sale.report_saleorder_document_copy_1']//t[@t-call='web.external_layout']/div/table/tbody/t[2]/tr/t/td[@name='td_name']" meta-name="td_name">

      <td name="td_quantity" class="text-center">

        <p>

          <span t-field="line.product_uom_qty"/>

        </p>

        <xpath position="after" expr="/t[@t-name='sale.report_saleorder_document_copy_1']//t[@t-call='web.external_layout']/div/table/tbody/t[2]/tr/t/td[@name='td_quantity'][2]/span[3]" meta-t-if="line.product_uom_id != line.product_id.uom_id" meta-class="text-center"/>

      </td>

    </xpath>

    <xpath position="after" expr="/t[@t-name='sale.report_saleorder_document_copy_1']//t[@t-call='web.external_layout']/div/table/tbody/t[2]/tr/t/td[@name='td_discount']" meta-name="td_discount" meta-t-if="display_discount" meta-class="text-center">

      <td>

        <p>

          <span t-field="line.price_reduce_taxexcl"/>

        </p>

      </td>

    </xpath>

  </data>

  <data>

    <xpath position="replace" expr="/t[@t-name='sale.report_saleorder_document_copy_1']//t[@t-call='web.external_layout']//td[@name='td_priceunit']/span[@t-field='line.price_unit']" meta-t-field="line.price_unit"/>

    <xpath position="inside" expr="/t[@t-name='sale.report_saleorder_document_copy_1']//t[@t-call='web.external_layout']//td[@name='td_priceunit']" meta-name="td_priceunit" meta-class="text-end ">

      <p><span class="text-end" t-field="line.price_unit"/></p>

    </xpath>

  </data>

  <data>

    <xpath position="replace" expr="/t[@t-name='sale.report_saleorder_document_copy_1']//t[@t-call='web.external_layout']//td[@name='td_taxes']/span" meta-t-out="taxes"/>

    <xpath position="inside" expr="/t[@t-name='sale.report_saleorder_document_copy_1']//t[@t-call='web.external_layout']//td[@name='td_taxes']" meta-name="td_taxes" meta-t-attf-class="text-center {{ 'text-nowrap' if len(taxes) &lt; 10 else '' }}">

      <p t-out="taxes">Tax 15%</p>

      <p class="text-end"><span t-field="line.price_tax"/></p>

    </xpath>

  </data>

  <data>

    <xpath position="attributes" expr="/t[@t-name='sale.report_saleorder_document_copy_1']//t[@t-call='web.external_layout']//td[@name='td_section_line']" meta-name="td_section_line" meta-colspan="99">

      <attribute name="colspan">100</attribute>

    </xpath>

  </data>

  <data>

    <xpath position="attributes" expr="/t[@t-name='sale.report_saleorder_document_copy_1']//t[@t-call='web.external_layout']//td[@name='td_note_line']" meta-name="td_note_line" meta-colspan="99">

      <attribute name="colspan">100</attribute>

    </xpath>

  </data>

  <data>

    <xpath position="attributes" expr="/t[@t-name='sale.report_saleorder_document_copy_1']//t[@t-call='web.external_layout']//td[@name='td_section_subtotal']" meta-name="td_section_subtotal" meta-colspan="99">

      <attribute name="colspan">100</attribute>

    </xpath>

  </data>

  <data>

    <xpath position="inside" expr="/t[@t-name='sale.report_saleorder_document_copy_1']//t[@t-call='web.external_layout']/div/div[5]" meta-class="oe_structure">

      <br/>

    </xpath>

  </data>

  <data>

    <xpath position="inside" expr="/t[@t-name='sale.report_saleorder_document_copy_1']//t[@t-call='web.external_layout']/div/div[9]/div" meta-class="oe_structure">

      <br/>

    </xpath>

  </data>

  <data>

    <xpath position="inside" expr="/t[@t-name='sale.report_saleorder_document_copy_1']//t[@t-call='web.external_layout']/div/div[10]/div" meta-class="oe_structure">

      <br/>

    </xpath>

  </data>

  <data>

    <xpath position="inside" expr="/t[@t-name='sale.report_saleorder_document_copy_1']//t[@t-call='web.external_layout']/div/div[11]" meta-class="oe_structure">

      <br/>

    </xpath>

  </data>

</data>

0
Avatar
Opusti
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Best Answer

Hi,


* Use text-center, text-end, or utility classes like col-x (width) to align content.

        <th class="text-center col-2">Price Excl</th>


* To render numeric expressions cleanly and consistently, replace t-field or t-out with:

           <span t-esc="line.price_unit * (1 - (line.discount or 0.0) / 100.0)" />


* Define Column Widths and Avoid Replacing Incorrect Nodes.

- Rather than replacing generic tags, target the correct sale order report template:

              - Inherit from sale.report_saleorder_document (not its copy).

              - Modify existing <th name="th_quantity">, <td name="td_priceunit">, etc.


Try the following code.


<odoo>

  <template id="report_saleorder_document_custom" inherit_id="sale.report_saleorder_document">


    <!-- Modify Table Headers -->

    <xpath expr="//thead/tr/th[@name='th_discount']" position="after">

      <th class="text-end" name="th_price_excl">Price Excl</th>

      <th class="text-end" name="th_tax">VAT</th>

    </xpath>


    <!-- Quantity Column -->

    <xpath expr="//th[@name='th_quantity']" position="attributes">

      <attribute name="class">text-end</attribute>

    </xpath>

    <xpath expr="//td[@name='td_quantity']" position="attributes">

      <attribute name="class">text-end</attribute>

    </xpath>


    <!-- Modify Table Data Rows: Add Price Excl and Tax -->

    <xpath expr="//td[@name='td_discount']" position="after">

      <td class="text-end" name="td_price_excl">

        <span t-esc="line.price_reduce_taxexcl"/>

      </td>

      <td class="text-end" name="td_tax">

        <span t-field="line.price_tax"/>

      </td>

    </xpath>


    <!-- Format Price Unit -->

    <xpath expr="//td[@name='td_priceunit']" position="replace">

      <td class="text-end" name="td_priceunit">

        <span t-esc="line.price_unit"/>

      </td>

    </xpath>


    <!-- Optional: Format subtotal for consistency -->

    <xpath expr="//td[@name='td_subtotal']" position="replace">

      <td class="text-end" name="td_subtotal">

        <span t-esc="line.price_total"/>

      </td>

    </xpath>


  </template>

</odoo>


* Ensure that the inherited template is correct.



Hope it helps.

1
Avatar
Opusti
Jitesh Jeram
Avtor

Thank you so much. This helped with the spacing.

https://ibb.co/JY687qw

How can I
- format the "Unit Price" & "Vat" (not the percentage) values to all look like the "Price Excl" value
- Calculate the discount amount and show it (similar to the "VAT" coloumn)
- Change the "Qty" to integer

Avatar
Jitesh Jeram
Avtor Best Answer

I also want to adjust the heading

https://ibb.co/5g7MRrBk

I want to move the red section to under the "Quotation" heading to the right of the customer details.

0
Avatar
Opusti
Avatar
D Enterprise
Best Answer

Hi,

Adds Price Excl and VAT columns after Discount

Ensures column counts between <thead> and <tbody> match

Formats all prices and numbers consistently using t-field

Aligns all numeric columns to the right with text-end

Avoids duplicated fields or broken nesting

please try this code 
<odoo>

    <data>


        <!-- HEADER: Add new columns after 'Discount' -->

        <xpath expr="//thead/tr/th[@name='th_discount']" position="after">

            <th class="text-end">Price Excl</th>

            <th class="text-end">VAT</th>

        </xpath>


        <!-- LINE ITEMS: Add matching <td> for new columns -->

        <xpath expr="//tbody//td[@name='td_discount']" position="after">

            <td class="text-end">

                <span t-field="line.price_reduce_taxexcl"/>

            </td>

            <td class="text-end">

                <span t-field="line.price_tax"/>

            </td>

        </xpath>


        <!-- QUANTITY COLUMN: Center align -->

        <xpath expr="//th[@name='th_quantity']" position="replace">

            <th name="th_quantity" class="text-center">Qty</th>

        </xpath>


        <xpath expr="//td[@name='td_quantity']" position="replace">

            <td name="td_quantity" class="text-center">

                <span t-field="line.product_uom_qty"/>

            </td>

        </xpath>


        <!-- PRICE UNIT COLUMN: Format properly -->

        <xpath expr="//td[@name='td_priceunit']" position="replace">

            <td name="td_priceunit" class="text-end">

                <span t-field="line.price_unit"/>

            </td>

        </xpath>


        <!-- SUBTOTAL / PRICE INCL COLUMN: Update header and value -->

        <xpath expr="//th[@name='th_subtotal']/span" position="replace"/>

        <xpath expr="//th[@name='th_subtotal']" position="inside">

            <span class="text-end">Price Incl</span>

        </xpath>


        <xpath expr="//td[@name='td_subtotal']" position="replace">

            <td name="td_subtotal" class="text-end">

                <span t-field="line.price_total"/>

            </td>

        </xpath>


        <!-- OPTIONAL: Ensure colspan is high enough for notes and sections -->

        <xpath expr="//td[@name='td_section_line']" position="attributes">

            <attribute name="colspan">100</attribute>

        </xpath>


        <xpath expr="//td[@name='td_note_line']" position="attributes">

            <attribute name="colspan">100</attribute>

        </xpath>


        <xpath expr="//td[@name='td_section_subtotal']" position="attributes">

            <attribute name="colspan">100</attribute>

        </xpath>


    </data>

</odoo>


i hope it is usefull

0
Avatar
Opusti
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Prijavi
Related Posts Odgovori Prikazi Aktivnost
Quote Builder With Custom Rental Report (Studio)
pdf
Avatar
0
okt. 25
475
Quote Builder With Custom Rental Report (Studio)
pdf
Avatar
0
okt. 25
4
How to edit the header of the quote template Solved
pdf
Avatar
Avatar
Avatar
2
avg. 25
1248
How to Edit Out the Blank Space in the Quote/Order Confirmation PDFs? Solved
pdf
Avatar
Avatar
Avatar
Avatar
3
avg. 25
2665
How to Disable Automatic PDF Download When Selecting "Invoice" in POS (Odoo Online)?
pdf
Avatar
1
jul. 25
1446
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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