19
1 View Customization How to customize views & menus of OpenERP Online in a sustainable way: the case of an Expertise Company Frédéric GILSON Functional Consultant at OpenERP Belgium – QuickStart Team OpenDays – July 4th 2013

How to customize views & menues of OpenERP online in a sustainable way. Frederic Gilson, OpenERP

  • Upload
    odoo

  • View
    15.814

  • Download
    1

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: How to customize views & menues of OpenERP online in a sustainable way. Frederic Gilson, OpenERP

1

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 LSONFunc t i ona l Consu l tan t a t OpenERP Be lg ium – Qu i ckSta r t Te am

OpenDays – Ju ly 4th 2013

Page 2: How to customize views & menues of OpenERP online in a sustainable way. Frederic Gilson, OpenERP

2

Content

● 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

Page 3: How to customize views & menues of OpenERP online in a sustainable way. Frederic Gilson, OpenERP

3

Goal

● 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

Page 4: How to customize views & menues of OpenERP online in a sustainable way. Frederic Gilson, OpenERP

4

Scope

Insured people reports an incident to Broker

Broker reports it to Insurance Company

Insurance company asks for Experts

to Our Company

Our company manages experts' missions.

Page 5: How to customize views & menues of OpenERP online in a sustainable way. Frederic Gilson, OpenERP

5

Customize a view

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)

Page 6: How to customize views & menues of OpenERP online in a sustainable way. Frederic Gilson, OpenERP

6

Inherited view

What is an inherited view?

Why an inherited view to modify an existing one?

ORIGINAL VIEWxml record

stored in database(uploaded from sources)

INHERITED VIEWnew xml record in database

ORIGINAL VIEW INHERITED VIEWUPDATED VIEW

Page 7: How to customize views & menues of OpenERP online in a sustainable way. Frederic Gilson, OpenERP

7

1. Add an existing field

Add customers' addresses in the list view● Create an inherited view:

● Object: res.partner

● Inherited view: res.partner.form

● XML architecture:

Page 8: How to customize views & menues of OpenERP online in a sustainable way. Frederic Gilson, OpenERP

8

2. Add new fields

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:

Page 9: How to customize views & menues of OpenERP online in a sustainable way. Frederic Gilson, OpenERP

9

3. Add a 'Group by'

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.

Page 10: How to customize views & menues of OpenERP online in a sustainable way. Frederic Gilson, OpenERP

10

4. Rename menu items

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

Page 11: How to customize views & menues of OpenERP online in a sustainable way. Frederic Gilson, OpenERP

11

5. Add new menu items

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

Page 12: How to customize views & menues of OpenERP online in a sustainable way. Frederic Gilson, OpenERP

12

6. Add a new selection field

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).

Page 13: How to customize views & menues of OpenERP online in a sustainable way. Frederic Gilson, OpenERP

13

6. Add a new selection field

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:

Page 14: How to customize views & menues of OpenERP online in a sustainable way. Frederic Gilson, OpenERP

14

7. Add new m2o fields

An issue has to be associated to:

● An Insurance company ● An expert ● An insured ● A broker

The two new fields must be related to the 'Partner' object as well.

→ Contact

→ Responsible

→ Missing field

→ Missing field

Page 15: How to customize views & menues of OpenERP online in a sustainable way. Frederic Gilson, OpenERP

15

7. Add new m2o fields

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 tabinto two columns!

Page 16: How to customize views & menues of OpenERP online in a sustainable way. Frederic Gilson, OpenERP

16

8. Add new o2m fields

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”

Page 17: How to customize views & menues of OpenERP online in a sustainable way. Frederic Gilson, OpenERP

17

8. Add new o2m fields

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:

Page 18: How to customize views & menues of OpenERP online in a sustainable way. Frederic Gilson, OpenERP

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

9. Conclusions

Page 19: How to customize views & menues of OpenERP online in a sustainable way. Frederic Gilson, OpenERP

19

Questions?

Thank you!