Sunteți pe pagina 1din 19

View Customization

How to customize views & menus


of OpenERP Online
in a sustainable way:
the case of an Expertise Company

Fr d r i c G I L S O N
F u n c t i o n a l C o n s u l t a n t a t O p e n E R P B e l g i u m Q u i c k S t a r t Te a m
OpenDays Jul y 4th 2013

Content
2

Goal

Scope

What is/Why an inherited view

Add an existing field

Add new fields

Add a 'Group by'

Rename menu items

Add new menu items

Add a new selection field

Add new m2o fields

Add new o2m fields

Goal
3

Use the standard OpenERP


(without any custom module)

Fully customize the Project


Management interface in order to
make it useful and
understandable for the customer

Scope
4

Insured people
Broker

reports it to

reports an incident to

Insurance Company

Insurance company
to

Broker

asks for

Experts

Our Company

Our company manages experts' missions.

Customize a view
5

2 steps to modify a view properly:

Modify the database structure


Create new fields in the model associated to the original view
(in Setting > Technical > Database Structure > Models)
Keep the 'x_' syntax in order the field to survive updates!

Modify the view


Add an inherited view (including the new fields) to the
original view
(in Setting > Technical > User Interface > View)

Inherited view
6

What is an inherited view?


ORIGINAL VIEW
xml record
stored in database
(uploaded from sources)

INHERITED VIEW
new xml record in database

Why an inherited view to modify an existing one?

ORIGINAL
UPDATED VIEW

INHERITED VIEW

1. Add an existing field


7

Add customers' addresses in the list view

Create an inherited view:

Object: res.partner

Inherited view: res.partner.form

XML architecture:

2. Add new fields


8

Add 'Insured' and 'Broker' checkboxes in the


customer form view (below 'Website')

Step 1: Edit the database structure

Create two new boolean fields in the 'Partner' model: i.e. 'x_insured' & 'x_broker'

Step 2: Create an inherited view for the form view

Object: res.partner / Inherited view: res.partner.form

XML architecture:

3. Add a 'Group by'


9

Add a 'Group by... City' in the customer list


view

Create a new inherited view

Object: res.partner / Inherited view: res.partner.select

XML architecture:

The view type is automatically set by OpenERP.

4. Rename menu items


10

Contextualize the Project menu items

Rename the main menu item Project in Claims

Go to Settings > User Interface > Menu Items and open the 'Project' item

In the 'Name' field, click on the translation icon and create/modify the translation

If you use the default English, you need to create a new translation. So install at least a
second language and duplicate the existing translation (from the form view) in order to
get automatically the right record ID (mandatory in that case).

Rename Issues in Missions

Etc

5. Add new menu items


11

Add 'Insured' and 'Broker' menu items in the


'Claims' menu

Create two new menu items in the 'Claims' menu

Go to Settings > Database Structure > Models and open the 'Partner' item
Create two new menu items based on this model (at the bottom) in 'Claims': 'Broker' and
'Insured'

Filter the customer list displayed based on fields added in the


customer view (Broker and Insured)

Click on the 'Insured' item and open 'Edit Action' in the developer menu

Add a domain value (filter): [('x_insured','=',True)]

Add a contect value (default value for new records): {"default_x_insured":True}

Do it the same for the 'Broker' item

6. Add a new selection field


12

A mission can be:

A storm

A robbery

A damage

An accident

Let's modify the view again in order to get a field with a


set of predefined items (selection field).

6. Add a new selection field


13

Add a new 'Incident type' selection field in the


Mission form (below the 'Category' field)

Step 1: Edit the database structure

Create one new field: i.e. 'x_issue_type' (field type: selection)


Expression: i.e. [('storm','Storm'),('robery','Robery'),('damage','Damage'),
('accident','Accident')]

Step 2: Create a new inherited view

Similar definition (inherited from Project Issue Tracker Form)

XML architecture:

7. Add new m2o fields


14

An issue has to be associated to:

An Insurance company

Contact

An expert

Responsible

An insured

Missing field

A broker

Missing field

The two new fields must be related to the 'Partner'


object as well.

7. Add new m2o fields


15

Add new fields in the Mission form

Step 1: Edit the database structure

Create two new many-to-one fields in the 'project.issue' model:


i.e. 'x_insured' & 'x_broker' (object relation: res.partner)

Domain for 'x_insured' to filter the available contacts: [('x_insured','=',True)]

Step 2: Create an inherited view including a tab

Object: project.issue / Inherited view: Project Issue Tracker Form

XML architecture:

A group divides a tab


into two columns!

8. Add new o2m fields


16

Missions should be directly visible in the customer


form view

If the customer is an insured: see the missions wherein he is


marked as insured
If the customer is a borker: see the missions wherein he is marked
as broker
Need of two different tabs which appear depending on the
customer type

Insured = True new tab Missions linked to this insured


Broker = True new tab Missions linked to this broker

8. Add new o2m fields


17

Add contextual 'Missions' tabs with new o2m fields


in the customer form

Step 1: Edit the database structure

Create two new one-to-many fields: i.e. 'x_missions_broker'

Object relation: project.issue / Relation field: x_broker_partner

Step 2: Create a new inherited view with 2 new tabs

Object: res.partner / Inherited view: res.partner.form

XML architecture:

9. Conclusions
18

TO SUMMARIZE:

We have customized the original Project Management interface to


entirely fit the context of our Expert Insurance company
New links between objects without extra module thanks to m2o and
o2m fields (i.e. customers & issues, meetings & issues, etc)
You just need to add short XML views (inspired by existing ones)
Sustainable thanks to inherited views (will get through updates and
migrations)

TIME SAVING

SaaS PLATFORM COMPATIBLE

Thank you!
19

Questions?

S-ar putea să vă placă și