以OpenERP7.0中的 hr_expense 模块为例:

如图中代码所示:

__init__.py :和普通 Python 模块中的__init__.py 作用相同,主要用于引用模块根目录下的.py文件,是每个OpenERP 模块必须的。(注意,前后均是两个下划线)
__openerp__.py :OpenERP
模块特有的,详细内容见后文,是每个OpenERP 模块必须的。
hr_expense.py
:费用单对象定义文件,Python代码。
hr_expense_view.xml
:费用单对象对应的视图(列表tree、表单form、搜索search)、动作(Action)、菜单(menu)定义文件。
hr_expense_sequence.xml :费用单单据编号规则定义文件。
hr_expense_workflow.xml
:费用单工作流定义文件。
hr_expense_report.xml :打印菜单定义文件,费用单打印中的“人力资源费用”菜单由此定义。关联Report文件夹下的打印模版文件和解析文件。
hr_expense_data.xml
:费用管理模块基础数据初始化文件。基础数据是模块正常运行必须的数据。
hr_expense_demo.xml
:演示数据定义文件。演示数据不是模块必须的数据。
board_hr_expense_view.xml
:费用单对应的报表(仪表盘)定义文件。

文件夹:

hr_expense:模块名,其他模块中引用当前模块中定义的对象时,需要使用 hr_expense. 前缀。

i18n:翻译文件,zh_CN.po 为中文简体翻译文件。
images:模块中主要功能截图展示文件。
process :企业流程(Enterprise Process)定义相关文件。
report :打印报表定义相关的文件,包括打印模版和解析文件。费用单打印中的“人力资源费用”报表在此定义。
security
:权限设置文件。通常包括两部分,ir_rule.xml 定义新的权限组(group)和角色(rule),ir.model.access.csv 定义权限组对对象(Object)的访问权限(增删改查)。
static:模块中使用的静态文件,如模块中使用的图片、css、js 等资源文件。
test:模块测试文件,供开发、测试人员使用。
wizard:向导文件,如查询报表中的过滤条件向导,费用关联模块中未使用。

其中需要特别介绍的为 __openerp__.py 文件,费用管理模块中该文件代码如下所示:

 # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
############################################################################## {
'name': 'Leave Management',
'version': '1.5',
'author': 'OpenERP SA',
'category': 'Human Resources',
'sequence': 27,
'summary': 'Holidays, Allocation and Leave Requests',
'website': 'http://www.openerp.com',
'description': """
Manage leaves and allocation requests
===================================== This application controls the holiday schedule of your company. It allows employees to request holidays. Then, managers can review requests for holidays and approve or reject them. This way you can control the overall holiday planning for the company or department. You can configure several kinds of leaves (sickness, holidays, paid days, ...) and allocate leaves to an employee or department quickly using allocation requests. An employee can also make a request for more days off by making a new Allocation. It will increase the total of available days for that leave type (if the request is accepted). You can keep track of leaves in different ways by following reports: * Leaves Summary
* Leaves by Department
* Leaves Analysis A synchronization with an internal agenda (Meetings of the CRM module) is also possible in order to automatically create a meeting when a holiday request is accepted by setting up a type of meeting in Leave Type.
""",
'images': ['images/hr_allocation_requests.jpeg', 'images/hr_leave_requests.jpeg', 'images/leaves_analysis.jpeg'],
'depends': ['hr', 'base_calendar', 'process', 'resource'],
'data': [
'security/ir.model.access.csv',
'security/ir_rule.xml',
'hr_holidays_workflow.xml',
'hr_holidays_view.xml',
'hr_holidays_data.xml',
'hr_holidays_report.xml',
'report/hr_holidays_report_view.xml',
'report/available_holidays_view.xml',
'wizard/hr_holidays_summary_department_view.xml',
'wizard/hr_holidays_summary_employees_view.xml',
'board_hr_holidays_view.xml',
],
'demo': ['hr_holidays_demo.xml',],
'test': ['test/test_hr_holiday.yml',
'test/hr_holidays_report.yml',
],
'installable': True,
'application': True,
'auto_install': False,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

其中:

name :模块名,任意文字。
version :版本号,如:1.0。

author:作者。
category:模块所属分类。
sequence:序号,在本地模块列表中的显示顺序。
summary:简要描述,在模块列表中显示。
website:网站。
description :模块详细描述,支持简单的富文本格式化显示,使用====,*号等标记。
images:模块中主要功能截图展示文件。
depends
:依赖模块,即安装本模块时将检查此处定义的模块,如果没安装,将自动一起安装。通常所有模块都要依赖 base 模块。本例工作流要依赖 process
模块,员工及部门经理关系用到 hr 模块。
data :模块安装和升级时需要重新加载的XML
文件,基础数据、权限、工作流、视图、报表等的定义文件通常放在此处。通常权限定义文件放在前面,因为其它文件常引用权限定义数据。
demo
:演示数据文件。
test :测试文件。
installable
:是否启用安装,通常固定为True

application:是否为应用程序。
auto_install:建库时是否自动安装。

openerp学习笔记 模块结构分析的更多相关文章

  1. [Cocos2d-x for WP8学习笔记] HelloWorld结构分析

    先来看一下目录结构: Assets:游戏资源文件,图片音频等,Resource文件夹也有类似功能 include:用于放置游戏头文件 Shaders:渲染器着色器文件(大雾) cocos2dorig. ...

  2. linux内核设计与实现学习笔记-模块

    模块 1.概念:  如果让LINUX Kernel单独运行在一个保护区域,那么LINUX Kernel就成为了“单内核”.    LINUX Kernel是组件模式的,所谓组件模式是指:LINUX K ...

  3. openerp学习笔记 webkit 打印

    1.webkit 打印需要安装的支持模块 请首先安装 Webkit 报表引擎(report_webkit),再安装 Webkit 报表的支持库(report_webkit_lib),该模块讲自动安装和 ...

  4. openerp学习笔记 自定义小数精度(小数位数)

    小数位数标识定义: lx_purchase/data/lx_purchase_data.xml <?xml version="1.0" encoding="utf- ...

  5. openerp学习笔记 跟踪状态,记录日志,发送消息

    跟踪状态基础数据: kl_qingjd/kl_qingjd_data.xml <?xml version="1.0"?><openerp>    <d ...

  6. openerp学习笔记 视图样式(表格行颜色、按钮,字段只读、隐藏,按钮状态、类型、图标、权限,group边距,聚合[合计、平均],样式)

    表格行颜色:             <tree string="请假单列表" colors="red:state == 'refuse';blue:state = ...

  7. python基础学习笔记——模块

    自定义模块 我们今天来学习一下自定义模块(也就是私人订制),我们要自定义模块,首先就要知道什么是模块啊 一个函数封装一个功能,比如现在有一个软件,不可能将所有程序都写入一个文件,所以咱们应该分文件,组 ...

  8. openerp学习笔记 统计、分析、报表(过滤条件向导、分组报表、图形分析、比率计算、追加视图排序)

    待解决:图形中当改变分组时,图例不正确            存储比率计算时,分组合计不正确 wizard:过滤条件向导,用于输入过滤条件 wizard/sale_chart.py # -*- cod ...

  9. openerp学习笔记 计算字段支持搜索

    示例1: # -*- encoding: utf-8 -*-import poolerimport loggingimport netsvcimport toolslogger = netsvc.Lo ...

随机推荐

  1. HDU 1104 Remainder (BFS求最小步数 打印路径)

    题目链接 题意 : 给你N,K,M,N可以+,- ,*,% M,然后变为新的N,问你最少几次操作能使(原来的N+1)%K与(新的N)%k相等.并输出相应的操作. 思路 : 首先要注意题中给的%,是要将 ...

  2. TinyMCE3.x整合教程-Xproer.WordPaster

    版权所有 2009-2017 荆门泽优软件有限公司 保留所有权利 官方网站:http://www.ncmem.com/ 产品首页:http://www.ncmem.com/webplug/wordpa ...

  3. schedule-pool模拟并行任务分片

    模拟并行任务分片 代码部分: package com.pool; import com.alibaba.fastjson.JSON; import java.io.BufferedReader; im ...

  4. Matlab图像处理教程

    虽然典型算法的开发是基于理论支持的,但这些算法的实现几乎总是要求参数估计,并常常进行算法修正与候选求解方案的比较. MATLAB由LINPACK和EISPACK项目开发,最初用于矩阵处理.今天,MAT ...

  5. src.rpm格式的RHCS源码提取

    RHCS源码下载(地址1:地址2) 参考文档(RHCS安装也配置) RHCS源码提取(参考) 方法一: (1)rpm –ivh magma-plugins-1.0.15-3.src.rpm   执行r ...

  6. hdu2993 MAX Average Problem (斜率dp)

    参考:http://www.cnblogs.com/kuangbin/archive/2012/08/27/2657878.html //#pragma warning (disable: 4786) ...

  7. Javascript与数据结构系列(一)——栈的实现

    栈的实现 实现一个栈,当务之急是决定存储数据的底层数据结构.这里采用的是数组. 我们的实现以定义 Stack 类的构造函数开始: function Stack() { this.dataStore = ...

  8. GetFileVersionInfoSize函数确定操作系统是否可以检索指定文件的版本信息

    GetFileVersionInfoSize函数 -------------------------------------------------- ------------------------ ...

  9. xml构建

    <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=346252320&site=qq ...

  10. ifstat命令行统计网络流量

      下载 ifstat ,  http://gael.roualland.free.fr/ifstat/ifstat-1.1.tar.gz   tar xzvf ifstat-1.1.tar.gz   ...