Training Module (1): Basic Framework/instructor management

Source: Internet
Author: User
ArticleDirectory
    • Requirement
    • Module framework
    • _ Openerp _. py
    • Teacher. py
    • Module. xml
    • Module Installation
Requirement

1. Complete the basic framework of the training module and install the module to the openerp system.

2. Ability to manage instructors. The instructor object contains the following information: Instructor name and contact number.

 

Module framework

The module name is east_training,Then it has four files:

 
| --East_training| --_ Init __. Py| --_ Openerp __. Py| --Teacher. py| -- Module. xml

 

_ Init _. py

The _ init _. py file is the description of the python module, because the openerp module is also a common Python module. 

#-*-Coding: UTF-8 -*-ImportTeacher

 

_ Openerp _. py

The _ openerp _. py file (also called _ terp _. py in versions earlier than 6.0) contains information about the python dictionary declaration module:

 #  -*-Encoding: UTF-8 -*-  {  "  Name  " : "  East Training System  " , #  Module name     "  Author  " : "  Eastson  " , #  Author      "  Version  " : "  0.17  " , #  Version     "  Depends  " :[ "  Base  " ], #  Dependency Module      "  Category  " : "  Generic modules/others  " , #  Module type     "  Website  " : "  Http://www.cnblogs.com/eastson  " , #  URL      "  Update_xml  " :[ "  Module. xml  " ], #  Files Read during module update     "  Active  "  : False,  "  Installable  " : True #  Can I install }

 

Teacher. py

The Training Instructor object definition file, inherited from OSV. OSV:

 #  -*-Encoding: UTF-8 -*-  From OSV Import  OSV, Fields Class  East_training_teacher (OSV. OSV): _ name = '  East_training.teacher  '  _ Columns = {  '  Name  ' : Fields. Char ( '  Instructor name  ' , Size = 64 ),  ' Phone  ' : Fields. Char ( '  Phone number  ' , Size = 32 )} East_training_teacher () 

 

Module. xml

Module definition files, such as menu items, tree views, and form views, are all defined here. It can be any file name or multiple files, corresponding to the update_xml entry of _ openerp _. py:

 <?  XML version = "1.0" encoding = "UTF-8"  ?>  <  Openerp  >      < Data  >          <  Menuitem  Name  = "East"  ID  = "Menu_east_training"  />          <  Menuitem  Name  = "Settings"  ID  = "Menu_east_training_settings"  Parent = "Menu_east_training"  />          <! --  Training/Setup/instructor  -->          <  Record  Model  = "Ir. Actions. act_window"  ID  = "Action_east_training_teacher"  >              <  Field  Name  = "Res_model" > East_training.teacher </  Field  >          </  Record  >          <  Menuitem  Name  = "Instructor"  ID  = "Menu_east_training_settings_teacher"  Parent  = "Menu_east_training_settings"  Action = "Action_east_training_teacher"  />      </  Data  >  </  Openerp  > 

 

Module Installation

1. Make sure that the current interface is in extended mode. Otherwise, the module management menu cannot be found.

2. Because east_training is a new module, you must update the module list to find it in the module list.

3. Find the new module east_training in the module list:

4. Click east_training to view the details of this module. Click Install to install the module.

5. Click the update button to install the module:

6. After the module is successfully installed, the newly added module will appear in the top menu:

 

Tip:

1. After the module is successfully installed, a data table with the same name as the object class is created in the background database by default, and some system fields are also created:

2. After the module is detached, the created database table will not be deleted, and the input data will be retained. The original data will also be retained during re-installation.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.