Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
13042 Представления

How to call a create method from other methods.

@api.model def process_demo_scheduler_queue(self):
        print "at the top"
        self.test1(1)

       _logger.info("here")
        print "at bottom"


 @api.noguess

@api.model def test1(self,vals):
        print "ki"

       attachment = super(scheduler_demo, self).create(vals)

       print attachment

       return attachment

This code not working. Any help??


Аватар
Отменить
Лучший ответ

dear Annadurai,


if you need to call create method within a same model just you can use :

self.create(vals)

vals is a dictionary have keys and values for required fields at least like this:
vals= {'field1':value, 'field2': value}

if you need to call create method from another model just you must declare object with this model and call create method like this:

model2_obj= self.env['model2.model2']
model2_obj.create(vals)


 I hope i helped you....

Аватар
Отменить
Автор

Thank you Ayam

Лучший ответ

Thank you, this helped.

Аватар
Отменить
Related Posts Ответы Просмотры Активность
3
июл. 19
78
3
сент. 23
5413
Libary managment Решено
2
мая 23
2098
2
дек. 18
9639
2
авг. 17
6729