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ợ

[18.0] How can I add a sequence to the lines in my sale order, invoice or purchase order?

Đă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ờ
salespdfsale.order.linequickstartQuickstart
3 Trả lời
6405 Lượt xem
Ảnh đại diện
Orlanda Rodríguez Montenegro (orrm)

I want to add a sequence to my sale order that addds a numerator on each line starting at 1. I'd like it to be on my sales PDF and in the view so the customer can make reference to a specific line.

0
Ảnh đại diện
Huỷ bỏ
Marcucci Jeremy

Good afternoon, 

Thanks a lot for all the explaination. I need it also for my order.

I have a small difference compare to the original asking, I need to start from 10 and increase each line by 10.

For example line 1 will be 10, line 2 will be 20, etc. Is it possible to make it ? I search all the day for it... 

I'm on odoo sh.

Thanks for your help and have a nice day.

Jeremy

Dinesh Hassani

I tried Ken's version and got success on all fronts, but couldn't get it on printed reports.... help if you know any better. I am using Odoo 19.

Ảnh đại diện
Orlanda Rodríguez Montenegro (orrm)
Tác giả Câu trả lời hay nhất

Part 1: (V.18) Add the sequence number for each item/product in the sales.order.line model. 


  1. From the sales.order model go to Studio.

2. Click on the “Edit list view” button to go to the sale.order.line model 


3. Add a related field to “sequence”.

4. Activate the Developer Mode

5. (Best practice) Change the label and then the technical name. 

Extra tip: When you finish typing the label, type "enter", wait for studio to load and it's coppied to the technical name.



6. Go to the a Sale Order and add a product in the sale lines to see how it works. 

We haven´t finished! The sequence starts with the number 10 and we need it to start from 1) Please go to the next step



7. In order to predefine the number 1 for the sequence as the default. Go to Settings / Technical / Actions / Use-defined defaults

8. Create a new User-defined Default 

  • Add the field: Sequence (Sales Order Line) -> You might need to search for it on the "search more" option
  • Default value: 1

If you don't find the field "search more" with these values: field: sequence, model: sale.order.line


9. Go to the sale.order model and see how it works. 


Note: You need to save it, in order to have a correct sequence. If you don't save it, you will always have the number 1 in the sequence field. 

Once it's saved you will have the correct sequence. 



Forum post part 2:

(V.18) How to add the sequence to the PDF?

  1. From the sale.order model go to Studio and find the reports you want to add the sequence field.


2. Insert a field 


3. Change the name of the field

4. In the rectangle below Type “/” and select “field”

5. Add the native field of Sequence (integer): 

6. Don´t forget to Save it 


7. Print the PDF and the sequence field will be shown.



8
Ảnh đại diện
Huỷ bỏ
Ahmed khalifa

I followed the same steps but it shows 1 , 1 , 1 for the line items then when i save it shows again 10,11,12
i compare the field: sequence which you made with mine, your screenshot shows the type is Base Field but mine shows it's Custom Field.
Could that be the problem?

Chris TRINGHAM

The Base Field is used on the pdf. It's already shown on the Form View but with a drag handle to re-sequence lines, so a new related field is added.

Probably you are trying to set the default value to 1 on the new related field, it needs to be on the Base field.

Christine Nguyen

Thank you, your solution is great. I followed it, but when I save, the sequence still stays as 1, 1, 1. It only reorders automatically when I drag and drop a line. How can I make it automatically adjust the sequence numbers 1, 2, 3 when I save the SO?

AljawahirSteel

when i add sequence field in report start the 0 not 1?

Apiuser

Is this possible to set up on CE?

Ảnh đại diện
Ken Nguyen
Câu trả lời hay nhất

For those who are still struggling with these solutions, I combined both methods, and it seems to work.  I used Sai's method up to the Sales Order Code.  I couldn't figure out which model the Invoice code was supposed to be on.  I also created the same code for the Purchase Order model.

i = 1
for line in record.order_line.sorted (key = lambda l: l.sequence):
    if not line.display_type:
        line.write ({'x_studio_line_number': i})
        i += 1

To get it to show on the Sales Quote or Purchase RFQ pdf, I used the part 2 instructions from Orlanda.  When you get to step Part 2 - Step 5, search for the Label or the Technical Name that you created from Sai's Step 1.  In my case, my Label is just "Line" while the technical name is "x_studio_line_number".  Once saved, it should now update the correct sequence.  Replicating other reports is the same process.  Go to the report, add a field, search for the field, and select the right label.  You don't need to redo Sai's step.

0
Ảnh đại diện
Huỷ bỏ
Ảnh đại diện
Sai Praveen
Câu trả lời hay nhất

1.Create a custom integer field on the line model (e.g., x_studio_no for sale order lines).

  • Go to Studio → Sale Order → Order Lines → Add a field (Integer).
  • Label it something like "Line Number" or "S.No."

2.Create an Automation Rule

  • Go to: Settings → Technical → Automation → Automated Actions.
  • Create a new rule:
    • Model: Sales Order
    • Trigger: On Save
    • Apply On Domain: leave it empty or match active orders
    • Add Server Action: Execute Python Code




  • Sample Code for Sale Order Lines:


  • Sample Code for Invoice Lines:



Note:The sequence field will show 0  before saving.It gets updated only after you save the record, because the automation is triggered On Save.



-2
Ả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
How to use the PDF Quote Builder and add Dynamic Fields with LibreOffice? [V17] Đã xử lý
sales pdf quickstart Quickstart
Ảnh đại diện
Ảnh đại diện
Ảnh đại diện
3
thg 6 25
7769
adding custom field in quotation/invoice
sales pdf
Ảnh đại diện
Ảnh đại diện
1
thg 11 25
321
How do I connect the Epson TM-T88VII to Odoo?
quickstart Quickstart
Ảnh đại diện
Ảnh đại diện
2
thg 10 25
823
How to Set Customer-Specific Product Names Đã xử lý
quickstart Quickstart
Ảnh đại diện
1
thg 8 25
1310
Odoo 18 Quotation Builder Header/Footer Print Problem Đã xử lý
sales pdf
Ảnh đại diện
Ảnh đại diện
2
thg 8 25
4330
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