Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
1897 Lượt xem

Hello, 

Our client is hosted on Odoo Online, so we cannot push any custom code. 

Our client wants to confirm all sales (status = sales order) with the status "Quotation sent". I try doing it with a automated action. But it's not working 

The trigger is creation date 

Here is a screenshot 


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

What you want to do? You want to change the old record status?

Tác giả

Yes, I would like that Odoo confirms all quotation sents to sales orders.

Câu trả lời hay nhất

Hello, 


Try this code 

x1 = env['sale.order'].browse(record.id)

for x in x1:

    if x.state=='sent':

        x.update({'state':'sale'})




Thanks

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

Hi,

Please change your Python code as below and try it again:for records in model.search([]):
  if records.state == 'sent':
    records.write({'state':'sale'})

You can also able to create a scheduled action:


if you create the schedules action as exactly as same as above it will only trigger one time, because the number of calls is '1'. If you want to execute daily or at all times according to your trigger time you can make the number of calls to '-1'


Hope it helps

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

Hello,

Sale Order -> "Confirm" -> action_confirm


If Setting ->  Automation ->  Automated Actions:


1. Try Code:

for rec in records:

  if rec.state == 'sent':

    rec.action_confirm()




Elif Setting -> Action ->  Server Actions:

1. Create Contextual Action: Click 
Action Name: SO status: sent to done
Model: Sales Order
Action To Do: Execute Python Code
Python Code:
for rec in records:

  if rec.state == 'sent':

    rec.action_confirm()


2. Sale Order -> Tree  -> Filters -> Add Custom Filter -> Status is  Quotation Sent
                             
-> Tree -> Checkbox Selected (all)
​     
-> Action -> SO status: sent to done


Else:
    
Contact me for more information: enginulger06@gmail.com

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 8 25
164
2
thg 8 25
1305
0
thg 2 25
1449
1
thg 1 25
2004
2
thg 12 24
1677