Skip to Content
Odoo Menu
  • Sign in
  • 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
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

Section line on customer invoice not displayed in invoice lines (but appears in accounting entries)

Subscribe

Get notified when there's activity on this post

This question has been flagged
accountinginvoicingaccount.moveodoo V18
96 Views
Avatar
harenakely

Hello everyone,

I’m working on Odoo 18 (enterprise) and I customized the invoice creation logic in sale.order to insert section lines grouping invoice lines by picking (delivery order).

The goal is:

  • When a customer invoice is created from multiple deliveries,

  • For each delivery order, insert a section line containing:

    "Order No. X – Delivery Note No. Y dated Z"

  • Then insert all invoice lines related to that picking under that section.

The section lines should appear in the invoice form view (as display_type='line_section'), and also in accounting entries. Here is the code that I did:

def _create_invoices(self, grouped=False, final=False):
        invoices = super()._create_invoices(grouped=grouped, final=final)

        for inv in invoices:

            lines_by_picking = {}

            for line in inv.invoice_line_ids:
                line_vals = line.copy_data()[0]

                picking = line.sale_line_ids.mapped("move_ids").mapped("picking_id")
                if picking:
                    picking = picking[0]
                    lines_by_picking.setdefault(picking, []).append(line_vals)

            inv.write({"invoice_line_ids": [(5, 0, 0)]})
            new_lines = []
            for picking, line_vals_list in lines_by_picking.items():
                section_name = _(
                    "Order No. %s - Delivery Note No. %s dated %s"
                ) % (
                    picking.sale_id.name,
                    picking.name,
                    picking.delivery_date.date().strftime('%d/%m/%Y') if picking.delivery_date else "",
                )
                print(section_name)
                new_lines.append((
                    0, 0, {
                        "display_type": "line_section",
                        "name": section_name
                    }
                ))
                for vals in line_vals_list:
                    vals.pop("sequence", None)
                    new_lines.append((0, 0, vals))
            inv.write({"invoice_line_ids": new_lines})

        return invoices

What works:

  • The section name is correctly generated (I printed it in the logs).

  • In the accounting entries, the section line does exist, with the correct name and display_type='line_section'.

  • When generating an invoice from a single delivery, it sometimes appears correctly.

The problem:

The section line does NOT appear in the invoice form view (account.move → tab "Invoice Lines") even though it:

  • exists in the database

  • has display_type='line_section'

  • appears under "Accounting entries" with the correct name

In the form view, the widget used is:

<field name="name" widget="section_and_note_text" optional="show"/>

But the section text stays blank / invisible.

What I suspect:

I think the issue might be related to:

  1. The way invoice lines are recreated ((5,0,0) then reinserting everything)

  2. The widget section_and_note_text not refreshing correctly

  3. The fact that invoice lines created programmatically may miss some required fields or context

  4. A missing value that the section widget expects, but I’m unsure which one

Expected behavior:

  • The section line should display normally in the invoice UI, as any manual section line does.

Questions:

  1. Is there something missing when creating a section invoice line programmatically?

  2. Does the section widget require a specific field value other than display_type='line_section' and name?

  3. Is recreating all invoice lines ((5,0,0)) the wrong approach in this case?

  4. Is there a better way to group invoice lines by picking when the invoice is generated?

Any help or insight on why the section line does not appear in the invoice form (while it exists in accounting entries) would be greatly appreciated.

Thanks in advance!

0
Avatar
Discard
Codesphere Tech

Hello,
This app is not fulfil the purpose you shared but it helps to understand the section grouping..
https://apps.odoo.com/apps/modules/18.0/cst_sale_orderline_grouping
Hope it is help.
Thanks

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

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

Sign up
Related Posts Replies Views Activity
Analytic Accounting in v17 Solved
accounting invoicing
Avatar
Avatar
Avatar
Avatar
3
Jul 25
3901
Journal Entry PB-Tab/2025/00007 is not valid. In order to proceed, the journal items must include one and only one outstanding payments/receipts account.
accounting invoicing
Avatar
Avatar
1
Mar 25
2351
Remove bank account from supplier
accounting account.move
Avatar
Avatar
1
Mar 25
2839
Cannot post invoice with any invoice date set in January 2024 Solved
accounting invoicing
Avatar
Avatar
1
Sep 25
2431
Comment savoir qu'une commande est entièrement facturée ? Solved
accounting invoicing
Avatar
Avatar
1
Feb 25
2065
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