Chapter 1

  1. What are the relevant layers to consider when designing an Odoo application?

First focus on the Data layer, structuring the data model, the models needed and their relations. Entity-relationship diagrams (ERDs) can be a useful tool for this.

Then think about the Presentation layer—how the user interface will be organized to fit the use cases to be supported.

Finally, think about the Logic layer, supporting the required business rules. These can be validations, automation, or helper features.

  1. How is Developer mode enabled?

Developer Mode, making available the Settings | Technical menu and the Debug contextual menu, can be enabled in the main Settings screen, using a link in the bottom-right. This has been so since Odoo 10.0; in Odoo 9.0 and before, it is enabled from the About dialog, accessed from the user menu in the top-right. It can also be enabled directly on the page URL, by changing the .../web?#... URL to  .../web?debug#....

  1. Where do you create a new Data model?

Data Models can be created and modified in the Settings app, in the Technical | Database Structure | Models menu option. To have the Technical menu available, you must have Developer Mode enabled. New models must have an x_ prefix, and new fields must also have this same  x_ prefix.

  1. How do you make a new data model available for the end users to create and edit records?

You should create a menu item for this, and in most cases, you will also want to design proper List and Form Views. You also need to add the ACLs to a group the user belongs to, or they won't be able to see the menu and views.

  1. How do you add a field to an existing form?

You first edit the model to add the new field, then find the base View for the form (for example, using the Debug menu). Then create an extension view for that base view, adding the new field.

  1. What is a Domain, and when can it be used?

It is a filter to apply when querying records from the database.

  1. How can you set default values on the form you're navigating to?

You do this by setting a context key with the default_ prefix, for example, {'default_x_name': '<Type description>'}. This context key can be set on Window Actions, used in Menu items, and for relational fields can be set on the View's field definition.

  1. How do you give a user access to a Model?

You first assign the ACL, for create, read, update, and delete, to a Group, and then make sure that the user belongs to that Group, directly or indirectly (indirectly belonging to another Group that inherits that one, such as Manager groups, which usually inherit from user groups).

  1. How can you add a Category field to the To-do items, with possible values selectable from an options list? (The options list is editable and can be expanded by users.)

Create a new Model called x_todo_category. No additional fields needed.

Edit the x_todo_item Model and add a x_category_id field, of the many-to-one type, with a related x_todo_category Model.

Edit the To-do item form view to add the new field: <field name="x_category_id" />.

Add the ACL to the To-do User group.

  1. How can you extend the To-do Category model so that the list of Categories is specific for each user?

It is enough to create a record rule on the To-do category for the To-do User Group. The domain to use is [('create_uid', '=', user.id)].

You could also reorganize the To-do menu to have two child menu items, Items and Categories.

The To-do top menu item should have no action defined, the Items menu item should reuse the existing Action to open the to-do list, and a new Action should be used on the Categories menu item, opening the To-do Category list.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.157.247