以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. [Selenium With C#基础教程] Lesson-05 文本框

    作者:Surpassme 来源:http://www.jianshu.com/p/7dca7d0d1ea3 声明:本文为原创文章,如需转载请在文章页面明显位置给出原文链接,谢谢. 文本框在Web页面中 ...

  2. SpringCloud教程 | 第三篇: 服务消费者(Feign)(Finchley版本)

    上一篇文章,讲述了如何通过RestTemplate+Ribbon去消费服务,这篇文章主要讲述如何通过Feign去消费服务. 一.Feign简介 Feign是一个声明式的伪Http客户端,它使得写Htt ...

  3. 软件加license的一种实现方法

    以前从没干过破解的勾当,这次确实必须要去破解一个,于是下了个反编译工具. 最终拿到反编译出来的文件,欣赏了一把它的license检测代码.原谅我的无知,以下代码在我看来还是比较新鲜,犬神请不要鄙视: ...

  4. Git SSH Key

     一.设置Git的user name和email: $ git config --global user.name "hhl_vip" $ git config --global ...

  5. Ubuntu下使用UFW,以及CentOS7的默认防火墙firewalld

    UFW是一个简化版的iptables,基于iptables,配置比iptables简单 默认UFW是关闭状态,即Ubuntu默认打开所有端口,比较危险. 检测状态 ufw status 设置默认状态, ...

  6. .net 异步函数 Async await

    .net  异步函数  Async await 一旦为函数添加async关键字 该函数就是一个异步函数. 异步方法必须返回 void 或 Task<> 类型. public static ...

  7. 基于JSP+Servlet开发高校社团管理系统(前台+后台) 源码

    基于JSP+Servlet开发高校社团管理系统(前台+后台): 开发环境:    Windows操作系统 开发工具:Eclipse/MyEclipse+Jdk+Tomcat+MYSQL数据库 运行效果 ...

  8. [javascript]模块化&命名污染—from 编程精解

    最近看了编程精解里面的模块化一章,很受启发. /****************/ 在开发的实际过程中,根据页面或者逻辑布局,js代码可以按照功能划分为若干个区块:数据交互.表单验证.页面布局等等模块 ...

  9. C# TinyIOC简单用法

    先添加一个接口 namespace IContract { public interface IBase { void ShowMessage(); } } 再添加两个实现类 namespace Co ...

  10. MySQL不带where条件的UPDATE和DELETE 限制操作说明

    本文来自 网易云社区 . 数据安全是业务的基石,但是DBA 总会遇到救火情况,业务误删除全表或者误更新错全表业务数据,导致服务不可用 sql_safe_updates参数可以限制不带where条件的u ...