Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
Since today I'm experimenting with Odoo 8 its project management module. What I really miss is an overview of all files that are attached to all projects. In essence a way to view all files stored for any project in a list.
What I would like to get is this:
And then when you click on this menu item you would get a view which shows ALL attached files for ALL projects. For example:
Could anybody tell me how to program this or build it? I'd like to learn more about customizing modules but I don't know how or where to start..
EDIT: I found some documentation at https://www.odoo.com/documentation/8.0/howtos/backend.html but it doesn't help me much further..
This is not the easiest task to start customizing Odoo (OpenERP).
Anyways, there are two ways to achieve your goal:
- Either use the web interface to add your menu and view
- Or create a custom module with python and xml
A quick overview of the seperate steps (for both ways mentioned above):
- Create your new menu item at the specific position
- Add a window action to the menu item to open your view
- Create the view for your attachments
Let's start with the view. From your screenshots I can see, that you want a kanban view for the attachments. I'm not very experienced with kanban views, so I will show you how to add a list view and you can add the kanban (and form) views, referring the offical view of the ir.attachment module.
If you choose to create a custom module, you will need a xml file with a designative name like project_attachment_view.xml. This file will contain the view, the action and the menu. The complete file content is surrounded by the tags <openerp> and <data> (xml tags are closed with the same tag with a slash in front </data> </openerp>). A view is a record of the module ir.ui.view and might look like that:
<record id="project_attachment_list_view" model="ir.ui.view">
<field name="arch" type="xml">
<tree string="Project Attachments">
The record name can be any name and the model is ir.attachments, since you want records of that model to be displayed. The architecture is of type xml and contains a tree view with some fields of the ir.attachment model. You can add all fields that are defined in a model (check ir_attachment.py for more fields).
If you decide to create your view via the web interface, create a new view under Settings -> Technical -> User Interface -> Views. (Make sure your user has Technical Settings checked under the users Access Rights).
Menu Items and Window Actions are also found under the Technical Settings menu.
Add all the required information according to the given code examples through the web interface.
Now for the new Window Action! In the same xml file add a new record for window actions like that:
<record id="open_project_attachment_view" model="ir.actions.act_window">
<field name="name">All Files</field>
<field name="domain">[('res_model', '=', 'project.project')]</field>
<field name="view_id" ref="project_attachment_list_view"/>
<field name="search_view_id" ref=""/>
The view_id should be the id that you have used for your previously coded view. view_type and view_mode are used to controll what kind of view are possible. The most tricky part is the domain. Since you want only documents displayed, that belong to projects, you have to filter all ir.attachment records. The field res_model contains the name of the related model. For the project model, the name is project.project.
Finally the menu item. Still in the same xml file add this:
The action is the id of the previously coded window action. The sequence gives the order of the menu items with the same parent menu. To have your menu item displayed after the Projects and Task menu, simply make the sequence big enough.
Last but not least, to make a module out of your xml file you need a new folder with a name like project_attachment. This folder should contain your xml file, a plain __init__.py file to tell python that the folder is a module, and a __openerp__.py file with further information. Your __openerp__.py should look like this:
'name': 'Project Attachment Menu',
'depends': ['project', 'ir.attachment'],
you should be able to install your new module if you place your new project_attachment folder under an valid addons folder. All addon folders are listed in the openerp-server.conf file of your OpenERP installation after the keyword addons_path as comma seperated list.
Hope I could help.
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 10/14/14, 2:37 AM|
|Seen: 4504 times|
|Last updated: 3/16/15, 8:10 AM|