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

what i'm doing is

i want to create same line before new line created with some changes 

Code Preview

الصورة الرمزية
إهمال
الكاتب

@Niyas Rephy yes

Please provide more description of what do you want to do

Hi, you are calling same create method inside the create method.

أفضل إجابة

Hi,

You can override the create method, and you can update the values inside the vals variable and pass it.

@api.model
def create(self, vals):
# update vals as per the need and pass
result = super(ClassName, self).create(vals)
return result

Thanks

الصورة الرمزية
إهمال
الكاتب

@Niyas Raphy thank you soo much for your help its solve my issue .... (y)

أفضل إجابة

Hi Usman,

Use res instead of self and also you need to pass some context to avoid recurrent calling

By Using Following Code

if not res._context.get('block_call'):
You need to define your code inside
While Calling Custom Create send Context like below code
self.with_context(block_call=True).create(values)

Thanks

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
0
أبريل 24
1927
0
ديسمبر 19
4614
5
ديسمبر 19
3721
0
أغسطس 19
4
1
فبراير 19
6960