Odoo Help

0

How Can I use Python Class Method in Odoo class put this class .py file in different folder

By
Irfankhan Juneja
on 1/29/16, 4:20 AM 849 views

e.g.


computation.py

------------------------

class A(object):

def hell(self, number)

{

----

}



b = A()




-----------------------------


sale module

sale.py


class sale_order(models.Model):

def abc(self):

# Here i wants to use that method hello() How can i use it?

1
Hardikgiri Goswami
On 1/29/16, 5:41 AM

Hi Irfankhan,

You can put computation.py file in the same folder in which sale.py file is placed and You can do following code in the sale.py.

from . import computation

and you can make object of class A in the following way:

b = computation.A()

and you can call method as follow:

b.hell(13)

Regards,

Hardik

0
Fabian
On 1/29/16, 5:06 AM

You have to import hello()

from computation import hello

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 1/29/16, 4:20 AM
Seen: 849 times
Last updated: 1/29/16, 5:41 AM