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

Lines in Sale Orders don't respect order in which they are entered

Subscribe

Get notified when there's activity on this post

This question has been flagged
invoicesequenceorderlinesopenerp7
3 Replies
9885 Views
Avatar
Santi

When I enter new lines in Sale Orders they are ordered correctly, but as soon as I click either the update or save buttons, the sequence in which the lines where ordered gets messed up.

I would like the lines to respect the order in which I enter them. How can I accomplish this? or am I the only one this issue?

1
Avatar
Discard
Avatar
Zbik
Best Answer

See: How to reorder lines in a quotation? 

UPDATE:

or you change default sort oder for sale.order.line from

_order = 'order_id desc, sequence, id' 

 to other, which suits you. For example:

class sale_order_line(models.Model): 
   _inherit = 'sale.order.line'
   _order = 'order_id desc, id'

 


-1
Avatar
Discard
Santi
Author

Thanks zbik, I already saw that, and use it on a daily basis, but that does not solve the core problem I have.

Santi
Author

My problem is that the lines do not maintain the order in which they are entered. I initially thought it was a misbehavior caused by one of the modules I had installed, but I created a new empty database with the very basic official modules installed and the same problem appeared to occur....so I'm really surprised I'm the only one complaining about it.

Zbik

@Rachid answer is for you, sequence field value determines order.

Zbik

... and ... if you drag and drop the default sequence value change.

Santi
Author

The behavior I've noticed is the following, if you enter each product line continuously by clicking "Add an item" and add all items one after another without abandoning the "Create: Order Lines" form by clicking "Save & New", once you're done entering them all this way and click "(update)" or "Save" the Sale Order, the items respect the order in which they where entered. BUT, if for example you add an item by clicking "Add an item" then click "Save & Close" on the ""Create: Order Lines", once you start adding items again, any new items you add will appear after the first line entered in the Sale Order one you save or update it, instead of being places after the LAST line in the sequence they have been added. This behaviour is very annoying specially when creating a quotation with many items, it can get all messed up and you have to drag and drop each item to place them in the intended order.

Santi
Author

Yes, if I drag and drop the sequence changes....but I shouldn't have to drag and drop! that's the thing. The lines should be respect the order in which they are entered...one after the other. Dragging and dropping should only be used if you want to modify the intended sequence later on.

Zbik

answer updated

Santi
Author

Thanks. I had tried that as well, that way the order of the lines work as it should....but, drag and drop does not work, since the sequence of the lines isn't taken into account. So I discarded that option as well....

Santi
Author

I have been further troubleshooting this, and there's some kind of obvious bug in the way the sequencing works. If you look in the database (PGAdmin3) in sale_order_line table, you'll see that if you add several items, the sequence increments, for example 10 (Item 1), 11 (Item 2), 12 (Item 3), 13 (Item 4)....but once you save or update the Sale Order, and then edit and add new lines, the sequence always starts at 11, for example 10 (Item 1), 11 (Item 5), 12 (Item 6), 13 (Item 2), 14 (Item 3), 15 (Item 4) .......when it should be as follows 10 (Item 1), 11 (Item 2), 12 (Item 3), 13 (Item 4), 14 (Item 5), 15 (Item 6)

Santi
Author

Does anyone else have this issue...or is it just me? As I mentioned earlier, I tried on a new empty database...and the same issue applies, so I don't think it's only me....

Zbik

In my system V8 all sequences value = 10, without drag and drop. V7 or V8? Field sequence is INTEGER can not change for no reason!

Santi
Author

Ok, you are right zbik, I narrowed it down to the module "nan_product_pack" being the one causing this misbehavior. The module increments the sequence per line, and in the process messes up the order. For some reason I installed this module in the new database as well and forgot I had done so later on....sorry for all the fuss, and thanks for you help zbik and Rachid, I'll try to figure out how to fix "nan_product pack" as it's an essential module in our business...

Avatar
Santi
Author Best Answer


Hi Rachid (sorry, I can't comment your post, as I need 50 karma points to do so),

I'm aware of the default sequence number, and that you can change it in sales.py file...or through a module. I'm also aware that you can reorder the lines by dragging and dropping them manually after they've been messed up. But what I don't understand is why the lines don't stay in the order I've added them by default.

For example, I add:

Line 1

Line 2

Line 3

I expect it to stay as:

Line 1

Line 2 

Line 3

and not as this, which is the actual behaviour:

Line 1

Line 3

Line 2

There doesn't seem to be much logic behind this default behaviour.

So far I haven't found many posts complaining about this issue, so I'm starting to suspect it might be a behaviour specific to my OpenERP installation. Is anyone else facing this issue (line order being messed upon save or update of the order/invoice/picking)?



1
Avatar
Discard
Tommy Lo

the same we are facing at Odoo 11

Avatar
Rachid
Best Answer

you can sort them with using the sequence field

the sequence take a default number=10

so if you want to make a line first you can put a minum sequence number like:

1st line : sequence=8

2nd line : sequence=9

3rd line : sequence=10

 

 

0
Avatar
Discard
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
Invoice lines and sale order lines relation Solved
invoice order lines
Avatar
Avatar
2
Jul 20
28332
How to export data by sequence?
invoice export data sequence order
Avatar
Avatar
Avatar
Avatar
3
Feb 25
5328
How to change Invoice sequence via xml in Odoo 15 or newer?
invoice sequence
Avatar
0
Sep 24
2089
Odoo 17.1 - How to never reset invoice number
invoice sequence
Avatar
Avatar
2
Mar 24
4000
How to select manually a sequence for an invoice? Solved
invoice sequence
Avatar
Avatar
2
Feb 23
4623
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