تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
7095 أدوات العرض

Hi everyone,

2 short questions :

1:
raise Usererror('test') and datetime() are causing empty errors on Odoo 15.0 community edition. Whats wrong there?

2:
Is it possible to call python function from automated actions? if it is, I would be grateful for an example.

Br

Sascha

الصورة الرمزية
إهمال
الكاتب أفضل إجابة

Okay- I will give the answer for me myself :

raise Usererror('test') and datetime() are causing empty errors on Odoo 15.0 community edition. Whats wrong there?

Version of Odoo 15 Community is to old, update to newer Version and RPC_Error is not empty anymore
https://github.com/odoo/odoo/pull/79399

This is also Answer to question 2 as it now gives back a qualified error message to debug.
Cheers :)

الصورة الرمزية
إهمال
أفضل إجابة

Hello Sascha,

I have included an example from the automation action as well as the preferred Odoo document.
https://www.odoo.com/documentation/16.0/applications/productivity/studio/automated_actions.html

Please find code in comment.

I hope this will help you.

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

الصورة الرمزية
إهمال

<record id="test_rule_on_write" model="base.automation">
<field name="name">Base Automation: test rule on write</field>
<field name="model_id" ref="base_automation.model_base_automation_lead_test"/>
<field name="state">code</field>
<field name="code" eval="'records.write({\'user_id\': %s})' % ref('base.user_demo')"/>
<field name="trigger">on_write</field>
<field name="active" eval="True"/>
<field name="model_id" ref="base_automation.model_base_automation_lead_test"/>
<field name="filter_domain">[('state', '=', 'done')]</field>
<field name="filter_pre_domain">[('state', '=', 'open')]</field>
</record>

OR

.xml file

<record id="test_rule_on_write" model="base.automation">
<field name="name">Base Automation: test rule on write</field>
<field name="model_id" ref="base_automation.model_base_automation_lead_test"/>
<field name="state">code</field>
<field name="trigger">on_write</field>
<field name="active" eval="True"/>
<field name="model_id" ref="base_automation.model_base_automation_lead_test"/>
<field name="filter_domain">[('state', '=', 'done')]</field>
<field name="filter_pre_domain">[('state', '=', 'open')]</field>
<field name="code">
if records:
records._my_func()
</field>
</record>

.py file

def _my_func(self):
add your code here....

الكاتب

Hey Jainesh !
Thankyou so much for your help, but unfortunately, I already tried this.
I get the same empty RPC_Error as I get on raise UserError('something').

On the other Hand this works well :
if record['service_state'] == "verzug_1":
env['esc.sst'].browse(record['id']).copy({'parent_id':record['id'],'service_state':'verzug_1','fk_status':3})

المنشورات ذات الصلة الردود أدوات العرض النشاط
0
سبتمبر 23
1726
3
يونيو 25
2419
0
مايو 24
1623
1
مارس 24
1520
1
يناير 24
1464