Example of module creation¶
Getting the skeleton directory¶
Create a travel directory, that will contain our addon. Create __init__.py file and __openerp__.py files.
Edit the __openerp__.py module manifest file:
{
"name" : "Travel agency module",
"version" : "1.1",
"author" : "Tiny",
"category" : "Generic Modules/Others",
"website" : "http://www.openerp.com",
"description": "A module to manage hotel bookings and a few other useful features.",
"depends" : ["base"],
"init_xml" : [],
"update_xml" : ["travel_view.xml"],
"active": True,
"installable": True
}
Changing the main module file¶
Now you need to update the travel.py script to suit the needs of your module. We suggest you follow the Flash tutorial for this or download the travel agency module from the 20 minutes tutorial page.
The documentation below is overlapping the two next step in this wiki tutorial,
so just consider them as a help and head towards the next two pages first...
The travel.py file should initially look like this:
from osv import osv, fields
class travel_hostel(osv.osv):
_name = 'travel.hostel'
_inherit = 'res.partner'
_columns = {
'rooms_id': fields.one2many('travel.room', 'hostel_id', 'Rooms'),
'quality': fields.char('Quality', size=16),
}
_defaults = {
}
travel_hostel()
Ideally, you would copy that bunch of code several times to create all the entities you need (travel_airport, travel_room, travel_flight). This is what will hold the database structure of your objects, but you don't really need to worry too much about the database side. Just filling this file will create the system structure for you when you install the module.
Customizing the view¶
You can now move on to editing the views. To do this, edit the custom_view.xml file. It should first look like this:
<openerp>
<data>
<record model="res.groups" id="group_compta_user">
<field name="name">grcompta</field>
</record>
<record model="res.groups" id="group_compta_admin">
<field name="name">grcomptaadmin</field>
</record>
<menuitem name="Administration" groups="admin,grcomptaadmin"
icon="terp-stock" id="menu_admin_compta"/>
</data>
</openerp>
https://doc.openerp.com/trunk/server/03_module_dev_05/
产品增加字段模块: add_new_field.zip
相关推荐
This tutorial will show you how to create a DotNetNuke module using LINQ to SQL. 这是项目源代码.初步学习LINQ有用.
标题《Creating a Visual Basic 6 Module From a DLL Header File.pdf》讲述了如何从一个DLL(动态链接库)头文件创建Visual Basic 6(VB6)模块。描述部分解释了如何在VB6中调用C或C++编写的DLL,涉及函数声明、...
"Creating a DotNetNuke® Module For absolute beginners"是一个教程,旨在帮助初学者了解如何在DNN平台上创建自定义模块。 1. **模块开发基础** - **DNN架构**:DNN采用模块化设计,允许开发者创建可复用的、可...
**1.9 Creating a Module with Dependencies** - **依赖**: 创建具有依赖关系的模块。 - **实现**: 在定义模块时声明依赖项。 - **例子**: `YUI.add('my-module', function(Y) { Y.use('node', function(Y) { /* ...
### ASP.NET - Module 7_Creating a Microsoft ASP.NET Web Application #### 概览 本模块主要介绍了如何创建一个Microsoft ASP.NET Web应用程序,并深入探讨了Web应用程序的要求、ASP.NET的新特性、页面间信息共享...
At the end of the book, you will learn how to make custom pages to manage data by creating a feedback module and how to create the order total using a tips module. In Getting Started with OpenCart ...
Creating Your First Module Logging and Mailing Theming Menus and Menu Links Data Modeling and Storage Your Own Custom Entities Database API Your Own Custom Fields Access Control Caching JavaScript in ...
This book will give you a clear, concise and, of course, practical guidance to take you from the basics of creating your first module to developing the skills to make you a Drupal developer to be ...
The Java Platform Module System is a language standard for creating these units. With modules, you can closely control how JARs interact and easily identify any missing dependencies at startup. This ...
Illustrate your data in a more interactive way by implementing data visualization principles and creating visual stories using Tableau About This Book Use data visualization principles to help you to...
根据给定的文件信息,我们将深入探讨如何在SAP MII(Manufacturing Integration and Intelligence)环境中创建事务以调用远程函数调用(RFC)模块,这在工业4.0和智能制造业中扮演着至关重要的角色。...
Module 7: Implementing a Tabular Data Model by Using Analysis ServicesThis module describes how to implement a tabular data model in Power Pivot.Lessons Introduction to Tabular Data Models Creating...
The CX9000 is a compact, DIN rail-... These interfaces are connected to an internal switch and offer a simple option for creating a line topology without the need for additional Ethernet switches.
- **Creating the worker module**: Explained as encapsulating the worker functionality within a separate script file. - **Keeping the same interface**: Mentioned as ensuring the worker module’s API is...
DDDebug is a collection of debugging tools which contains several modules: a memory profiler, a thread viewer, a module viewer and an enhanced exception handler. DDDebug can be integrated easily into ...