openerp学习笔记 模块结构分析
以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学习笔记 模块结构分析的更多相关文章
- [Cocos2d-x for WP8学习笔记] HelloWorld结构分析
先来看一下目录结构: Assets:游戏资源文件,图片音频等,Resource文件夹也有类似功能 include:用于放置游戏头文件 Shaders:渲染器着色器文件(大雾) cocos2dorig. ...
- linux内核设计与实现学习笔记-模块
模块 1.概念: 如果让LINUX Kernel单独运行在一个保护区域,那么LINUX Kernel就成为了“单内核”. LINUX Kernel是组件模式的,所谓组件模式是指:LINUX K ...
- openerp学习笔记 webkit 打印
1.webkit 打印需要安装的支持模块 请首先安装 Webkit 报表引擎(report_webkit),再安装 Webkit 报表的支持库(report_webkit_lib),该模块讲自动安装和 ...
- openerp学习笔记 自定义小数精度(小数位数)
小数位数标识定义: lx_purchase/data/lx_purchase_data.xml <?xml version="1.0" encoding="utf- ...
- openerp学习笔记 跟踪状态,记录日志,发送消息
跟踪状态基础数据: kl_qingjd/kl_qingjd_data.xml <?xml version="1.0"?><openerp> <d ...
- openerp学习笔记 视图样式(表格行颜色、按钮,字段只读、隐藏,按钮状态、类型、图标、权限,group边距,聚合[合计、平均],样式)
表格行颜色: <tree string="请假单列表" colors="red:state == 'refuse';blue:state = ...
- python基础学习笔记——模块
自定义模块 我们今天来学习一下自定义模块(也就是私人订制),我们要自定义模块,首先就要知道什么是模块啊 一个函数封装一个功能,比如现在有一个软件,不可能将所有程序都写入一个文件,所以咱们应该分文件,组 ...
- openerp学习笔记 统计、分析、报表(过滤条件向导、分组报表、图形分析、比率计算、追加视图排序)
待解决:图形中当改变分组时,图例不正确 存储比率计算时,分组合计不正确 wizard:过滤条件向导,用于输入过滤条件 wizard/sale_chart.py # -*- cod ...
- openerp学习笔记 计算字段支持搜索
示例1: # -*- encoding: utf-8 -*-import poolerimport loggingimport netsvcimport toolslogger = netsvc.Lo ...
随机推荐
- Spring实战-README.md
教程 <Spring实战>(第四版),[美]Craig Walls著,张卫滨译 人民邮电出版社,2016.4 本系列博文包括: 第01章-Spring之旅 第02章-装配Bean 第03章 ...
- 编写高质量代码改善C#程序的157个建议——建议78:应避免线程数量过多
建议78:应避免线程数量过多 在多数情况下,创建过多的线程意味着应用程序的架构设计可能存在着缺陷.经常有人会问,一个应用程序中到底含有多少线程才是合理的.现在我们找一台PC机,打开Windows的任务 ...
- 【图解HTTP】第二章 简单的http协议
简单的HTTP协议 针对HTTP协议结构进行讲解,主要使用HTTP/1.1版本. HTTP协议用于客户端和服务器端之间的通信 通过请求和响应的交换达成通信(从客户端开始建立通信,服务器端在没有接收到请 ...
- 【微服务架构】SpringCloud之Eureka(服务注册和服务发现基础篇)(二)
上篇文章讲解了SpringCloud组件和概念介绍,接下来讲解一下SpringCloud组件相关组件使用.原理和每个组件的作用的,它主要提供的模块包括:服务发现(Eureka),断路器(Hystrix ...
- PyCharm可用Active Code分享
目前可用,不保证更新!请及时取用. 6YQUPH9R7H-eyJsaWNlbnNlSWQiOiI2WVFVUEg5UjdIIiwibGljZW5zZWVOYW1lIjoi5o6I5p2D5Luj55C ...
- Git SSH Key
一.设置Git的user name和email: $ git config --global user.name "hhl_vip" $ git config --global ...
- XE5安卓手机要求
1 ARMv7 的 CPU v6 的肯定不支持.2 黑屏是因为你的手机 CPU 不支持 NEON 特性.或者是 T2 CPU.3 系统版本 2.3.3 到 2.3.9 或者 4.0 以上.4. SD ...
- java 调用javascript
首先我们在D盘的根目录下有一个js文件 名叫 common.js 假设里面有一个这样的方法 /** * @param int * _number 你想要的最大值 * @param ...
- AI_图像识别
http://ai.baidu.com/forum/topic/show/595938 经测试识别率相当高,车辆信息识别 文中的import cv2不是python3自带库,需要安装pip3 inst ...
- 基于python+selenium的框架思路
设想: 1.使用excel编写用例第一个sheet页为用例概要格式如下: 后面的sheet页为具体的用例步骤: 实现所有定位信息都与测试代码分离 2.读取该excel文件取出关键字等信息,作为关键字的 ...