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

Hello, 


We have an Automation Rule 

-> send a Webhook notification to the Web App

-> trigger On Save, on Contact


Then Web App 

-> process the Contact

-> and Save the updated fields


Then ... Odoo trigger the first  Automation 


Is there a solution to stop this loop ? Any test somewhere to block it ?


 

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

Hello Chathura 

It's look very logical however the condition tab is not present in the Odoo

Can you help me to find it ?


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

Hello, 

Try using context flags

In your automation rule

Add a condition to check for a context flag,

  1. Go to settings → technical → automation rules
  2. Edit your automation rule
  3. In the conditions tab, add a python expression,

python

not env.context.get('skip_webhook_automation', False)

In your web app xml-rpc call

When updating from your web app, include the context flag,

python

# Python example for XML-RPC
import xmlrpc.client

# Your Odoo connection
odoo = xmlrpc.client.ServerProxy('http://your-odoo-instance/xmlrpc/2/object')

# Update with context to skip automation
result = odoo.execute_kw(
    db, uid, password,
    'res.partner', 'write',
    [[partner_id], {'field_name': 'new_value'}],
    {'context': {'skip_webhook_automation': True}}
)
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 5 25
670
2
thg 8 25
192
2
thg 8 25
1331
0
thg 2 25
1456
1
thg 1 25
2051