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

Is there any way to call a wizard after creating an object in odoo11? or perhaps use some sort of after_create method?

I've tried this code but it doesn't seem to work

@api.model
def create(self, values):
    a= super(MyModel, self).create(values) 
    self.open_wizard()
    return a

def open_wizard(self):
    return {
'name': 'my wizard',
'type': 'ir.actions.act_window',
'res_model': 'my.wizard',
'view_type': 'form',
'view_mode': 'form', 'target': 'new'}
الصورة الرمزية
إهمال

You can call return only once

الكاتب

Yes, but the create method doesn't work without returning the created object

أفضل إجابة

Hi David,

You Can't able to create wizard after Creating object.

In Create and Write Method, you must return created object otherwise it will throws the error.

Thanks.

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

Your best bet might be to give new records a certain status which causes the record's fields to be readonly / invisible and for a button to be shown, which the user can then click to launch the wizard.

Alternatively, you can prevent users from being able to create the record directly by adding create="0" on the tree view, and create the record programmatically as part of a wizard.

HTH

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
5
سبتمبر 23
24775
2
ديسمبر 21
7420
1
أغسطس 20
8703
1
أغسطس 20
4813
9
سبتمبر 19
4069