Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
2855 มุมมอง

i want to generate a new Sale Order No. (Sequence) when a user press Confirm button on the Quotation screen. 


which field will be updated and what value updated when user Confirm it so i can use it in Automated Action - On Update to generate the sequence for this confirmed order.

please also help to write Python Code to execute to generate new Sequence No.

regards


อวตาร
ละทิ้ง
ผู้เขียน

i have done as below, please advise:

1) created a custom field = x_confirm_sale_order_seq in sale.order

2) created a sequence (copied sale.order sequence & modified as required)

3) created an Automated Action (Trigger: On Update - Trigger Field: state)

Python Code:

if record.state == 'sale':

  if not record.x_confirm_sale_order_seq:

    seq = env['ir.sequence'].next_by_code('sale.order.confirm.seq')

    record.write({'x_confirm_sale_order_seq': seq})

when trying to Confirm in Quotations it is showing error:

ValueError: class 'ValueError': "invalid literal for int() with base 10: 'S000026'"

the sequence i have created as below:

Name: Sales Order Confirm Seq

Sequence Code: sale.order.confirm.seq

Sequence Size: 6

Steps: 1

Prefix: S

Next Number: 25

regards


คำตอบที่ดีที่สุด

Hi,

You can change the sequence of the Sale Order functionally from the options Sequences under the Technical Menu in General Settings.

To change the sequence functionally you can refer this blog:

https://www.cybrosys.com/odoo/odoo-books/odoo-16-accounting-book/ch7/sequence-number-modification-operations/

If you want to change the sequence through technically when creating a new record in the sale order or in any model, you can refer this blog:

https://www.cybrosys.com/blog/how-to-create-sequence-numbers-in-odoo-16


Hope it helps

อวตาร
ละทิ้ง
ผู้เขียน

thank you @Cybrosys but please see my Answer to this query, i already have done but don't know why it is throwing error.

regards

Please mention the type of "x_confirm_sale_order_seq" because the error message means that perhaps you are writing string value into integer field.

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ต.ค. 24
2755
0
ส.ค. 23
2099
How to generate sequence value แก้ไขแล้ว
1
มี.ค. 23
3253
0
ม.ค. 24
1526
5
ก.ย. 25
21316