Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
9315 Widoki

Sale Order sequence based on Order type

Here we have 3 types sale orders

1) Domestic

2) Export

3) Disposal

So we need sequence like this

Domestic = DOM/SO/20-21/0001

Export = EXP/SO/20-21/0001

Disposal = DIS/SO/20-21/0001


How to configure this one in Odoo 9

Awatar
Odrzuć
Najlepsza odpowiedź

I'm not familiar with Odoo 9, but you should be able to create multiple sequence numbers and apply them using an Automated Action.

Here's an example that's similar to your requirement (in Odoo 12).

Start by enabling developer mode and navigate to Settings / Technical / Sequences

Create a new sequence (or copy an existing one):

Navigate to Settings / Technical / (Automation) / Automated Actions and create a new Automated Action:

Python Code:

for record in records:
  if record.x_studio_order_type == "Consumer":
    ref = env['ir.sequence'].next_by_code('consumer.sale.order')
    record['name'] = ref

We need to use the same Sequence Code [consumer.sale.order] as the one we used on the Sequence we created above.

You would need three Sequences and to include all of them in the Python Code:

for record in records:
    if record.x_order_type == "Domestic":
        ref = env['ir.sequence'].next_by_code('domestic.sale.order')
        record['name'] = ref
    if record.x_order_type == "Export":
        ref = env['ir.sequence'].next_by_code('export.sale.order')
        record['name'] = ref
    if record.x_order_type == "Disposal":
        ref= env['ir.sequence'].next_by_code('disposal.sale.order') 
        record['name'] = ref

https://odootricks.tips/set-sequence-numbers-for-sales-orders/

Awatar
Odrzuć
Autor

Thanks for your reply Mr Chris TRINGHAM

I will try on this way

Powiązane posty Odpowiedzi Widoki Czynność
0
lis 15
4293
1
cze 16
8030
1
gru 15
4916
0
gru 15
3011
1
mar 15
7430