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

Hai Friends ,

First I thank everyone , who give such support for newbie . When I started learning about creating custom module . Some Question raised in my mind .
  1. In __init__.py , what are the module (or) sub-module to be imported ?

  2. If my module _inherit another module , should i import the _inherit module in __init__.py ?

  3. What is purpose of declaring the module in __init__.py ?

Please clarify my doubt & once again thanks for everyone .

Thanks & Regards OMPRAKASH.A

الصورة الرمزية
إهمال

You need to know about odoo module structure: https://goo.gl/cPZ6gM

أفضل إجابة

n __init__.py file the modules which u going to import are ...the business logic files, having extension .py , for sales.py .

There is no need of _inheriting the module in __init__.py file.

__init__.py is used to initialize your module and its mandatory in each and every module u create

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

Hi mihir shah , Thanks for your immediate reply . I can understand your points . If you explain with some example it make more useful for me .. And once again thanks for your reply ... OMPRAKASH.A

Hi omprakash , for eg. If you are creating a customized module name school_management. in that first you create __init__.py file in that you import stu_reg ,after that __openerp_.py in this file you declare about all the views , dependencies ,(if any ) else always base. then you create stu_reg.py file name should be same as which is import in __init_.py file. In stu_reg.py file import fields ,osv and declare all the object models with there fields and data types . also you can define function if needed in stu_reg.py file

now create stu_reg.xml file for the view purpose.the structure of the xml view is given in documentation . so now when add this custom module to addons folder and try to install it , openerp by default first calls __init__.py file then __openerp__.py for initializing your module . hope my ans satisfying

الكاتب

Hi mihir shah , Thanks for your reply .Now i have idea about __init__.py file . But need more clarification please help me ... 1.) except import stu_reg , whether we will import another module ? If we import when ? And once again thanks for your reply ....OMPRAKASH.A

Hi omprakash, yes you can import n number of py files in __init__.py. after importing stu_reg i want to register teacher so i made tech_reg.py file. then i just have to import tech_reg in __init__.py file. But i would suggest that ..if you have different module for different business logic ,so as to use modular structure of openerp. and makes it more usable

المنشورات ذات الصلة الردود أدوات العرض النشاط
1
مارس 21
18211
1
مارس 15
9463
2
أكتوبر 23
3372
1
يناير 23
5403
0
سبتمبر 17
4791