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

How can I call a method, from another method of the same class and of different classes, according to a condition. use several codes (#) but none of them executes the conditions methods.

@api.multi

    def action_crear_documento1(self):

        if self.type=="sale":

            if self.invoice_type_code_id=="08":

                self.pool.get('account.journal').action_boleta_venta1(self)

                #journal=self.env['account.journal']

                #journal.action_boleta_venta1()

            elif self.invoice_type_code_id=="01":

                self.pool.get('account.journal').action_boleta_venta1(self)

                #journal=self.env['account.journal']

                #journal.action_boleta_venta1()

                #return self.action_boleta_venta4

   

    @api.multi

    def action_boleta_venta4(self):

        #code

       


    @api.multi

    def action_boleta_venta3(self):

        #code



Аватар
Відмінити
Найкраща відповідь

Hi,

You can make call like this,

self.env['model_name'].method_name() .

Example:

self.env['account.journal'].action_boleta_venta1()


If you are developing a module I will suggest you have a look at the odoo code and see how similar things are done inside the odoo itself and refer those things.

Thanks

Аватар
Відмінити
Автор

I used this code, I think it's the same, and it didn't address me. I will check it again. Thank you.

#journal=self.env['account.journal']

#journal.action_boleta_venta1()

Related Posts Відповіді Переглядів Дія
2
серп. 25
2419
1
лип. 25
915
1
серп. 25
1151
0
трав. 25
1347
2
квіт. 25
3568