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

In regular odoo using python, we can define function within a model. And then we can call these on button action. Does odoo online support this kind of feature To define funtion at custom model object.


i wanted to call a function of my transient model used in wizard with odoo online but could not find a way to define it. Also, when i use server action, i do not have access to my wizard‘s transient model.


any help is appreciated!!

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

Hi,
In Odoo online, if you need to trigger a function from button you can do as follows:

* create a server action and write your logic here or call any existing function from here.
​For eg: if you need to trigger action_confirm function in sale order model, create a server action with model as sale.order and action to do as execute python code and in the code section add record.action_confirm().  You can iterate it over for record in records to handle multiple records

* once server action is created copy its ID and in your button, set the type as action and in the name give this ID

This is how you can trigger a function from a button in odoo online.

Thanks

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
0
نوفمبر 23
1119
2
سبتمبر 23
864
2
مايو 22
21667
2
نوفمبر 19
20861
1
أغسطس 19
10000