Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
5 Відповіді
2689 Переглядів

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

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
0
квіт. 24
1820
0
груд. 19
4542
5
груд. 19
3612
0
серп. 19
4
1
лют. 19
6851