Daily updates from Odoo
Friday, December 2, 2022
2 changes
Enhancements to existing features
Odoo’s settings screens have been reorganized using a common structure for applications, groups, and individual settings. This makes settings more consistent, easier to browse, and easier to maintain across many business apps.
Original PR description
The aim of this commit is to simplify and standardize the settings archs. To do this, a small DSL exclusively for the settings was created. This new DSL introduces 3 tags: `app`, `block` and…
The aim of this commit is to simplify and standardize the settings archs.
To do this, a small DSL exclusively for the settings was created. This new DSL introduces 3 tags: `app`, `block` and `setting`.
## `app`
The `app` tag is used to declare the application on the settings view. It creates an entry with its logo on the sidebar of the view. It also acts as delimiter when searching.
### Syntax
```xml
<app string="CRM" name="crm">
...
</app>
```
### Parameters
- `string` : The "display" name of the application.
- `name` : The technical name of the application (the name of the module).
- `logo` *optional* : The relative path to the logo. If not set, the logo is created using the `name` parameter : `/{name}/static/description/icon.png`.
## `block`
The `block` tag is used to declare a group of settings. This group can have a title and a description/help.
### Syntax
```xml
<block title="Title of group Bar">
...
</block>
```
### Parameters
- `title` *optional* : The title of the block of settings (the old h2), you can perform research on its text.
- `help` *optional* : The description/help of the block of settings (the old h3), you can perform research on its text.
## `setting`
The `setting` tag is used to declare the setting itself. The first field in the setting is used as the main field (optional). This field is placed on the left panel (if it's a boolean field) or on the top of the right panel (otherwise). The field is also used to create the setting label if a `string` is not defined. The `setting` tag can also contain more elements (e.g. html), all of these elements are rendered in the right panel.
### Syntax
```xml
<setting string="this is bar">
<field name="bar"/>
...More elements
</setting>
```
### Parameters
- `type` *optional* : By default, a setting is visually separated on two panels (left and right), and is used to edit a given field. By defining `type='header'`, a special kind of setting is rendered instead. This setting is used to modify the scope of the other settings. For example, on the website application, this setting is used to indicate to which website the other settings apply. The header setting is visually represented as a yellow banner on the top of the screen.
- `string` *optional* : The text used as label of the setting. If it's not defined, the first field is used as label.
- `title` *optional* : The text used as tooltip.
- `help` *optional* : The help/description of the setting. This text is displayed just below the setting label (with classname `text-muted`).
- `company_specific` *optional* : If this attribute is set to "1" an icon is displayed next to the setting label to explicit that this setting is company-specific.
- `documentation` *optional* : If this attribute is set, an icon is added next to the setting label, this icon is a link to the documentation. Note that you can use relative or absolute path. The relative path is relative to `https://www.odoo.com/documentation/server_version`, so it's not necessary to hard-code the server version on the arch anymore.
## Example
```xml
<app string="CRM" name="crm">
<setting type="header" string="Foo">
<field name="foo" title="Foo?."/>
<button name="nameAction" type="object" string="Button"/>
</setting>
<block title="Title of group Bar">
<setting help="this is bar" documentation="/applications/technical/web/settings/this_is_a_test.html">
<field name="bar"/>
</setting>
<setting string="This is Big BAR" company_specific="1">
<field name="bar"/>
</setting>
</block>
<block title="Title of group Foo">
<setting string="Personalize setting" help="this is full personalize setting">
<div>This is a different setting</div>
</setting>
</block>
</app>
```
More examples can be found in the code base.
## Example of the simplification of the code
```diff
- <div class="app_settings_block" data-string="CRM" string="CRM" data-key="crm">
+ <app string="CRM" name="crm">
- <div class="row app_settings_header my-0 ms-0 mw-100 bg-warning bg-opacity-25">
- <div class="col-xs-12 col-md-6 ms-0 o_setting_box">
- <div class="o_setting_right_pane border-start-0 ms-0 ps-0">
- <div class="content-group">
- <div class="row flex-row flex-nowrap mt8 align-items-center">
- <label class="col ps-0 text-nowrap" string="Foo" for="foo"/>
- <field name="foo" title="Foo?."/>
- <button name="nameAction" type="object" string="Button" class="col-auto btn-link ms-2 text-nowrap" style="line-height: 0.5;"/>
- </div>
- </div>
- </div>
- </div>
- </div>
+ <setting type="header" string="Foo">
+ <field name="foo" title="Foo?."/>
+ <button name="nameAction" type="object" string="Button"/>
+ </setting>
- <h2>Title of group Bar</h2>
- <div class="col-xs-12 row o_settings_container">
+ <block title="Title of group Bar">
- <div class="col-xs-12 col-lg-6 o_setting_box">
- <div class="o_setting_left_pane">
- <field name="bar"/>
- </div>
- <div class="o_setting_right_pane">
- <a href="https://www.odoo.com/documentation/master/applications/technical/web/settings/this_is_a_test.html" title="Documentation" class="o_doc_link" target="_blank"/>
- <div class="text-muted">
- this is bar
- </div>
- </div>
- </div>
+ <setting help="this is bar" documentation="/applications/technical/web/settings/this_is_a_test.html">
+ <field name="bar"/>
+ </setting>
- <div class="col-xs-12 col-lg-6 o_setting_box">
- <div class="o_setting_left_pane">
- <field name="bar"/>
- </div>
- <div class="o_setting_right_pane">
- <label for="bar" string="This is Big BAR" />
- <span class="fa fa-lg fa-building-o" title="Values set here are company-specific." aria-label="Values set here are company-specific." groups="base.group_multi_company" role="img"/>
- </div>
- </div>
+ <setting string="This is Big BAR" company_specific="1">
+ <field name="bar"/>
+ </setting>
- </div>
+ </block>
- <h2>Title of group Foo</h2>
- <div class="col-xs-12 row o_settings_container">
- <div class="col-xs-12 col-lg-6 o_setting_box">
- <div class="o_setting_left_pane">
- </div>
- <div class="o_setting_right_pane">
- <span class="o_form_label">Personalize setting</span>
- <div class="text-muted">
- this is full personalize setting
- </div>
- <div>This is a different setting</div>
- </div>
- </div>
- </div>
+ <block title="Title of group Foo">
+ <setting string="Personalize setting" help="this is full personalize setting">
+ <div>This is a different setting</div>
+ </setting>
+ </block>
- </div>
+ </app>
```
This commit also promotes the use of the well-known tag `group` in settings archs. For instance:
```xml
<div class="content-group">
<div class="row mt16">
<label for="bar" class="col-lg-4 o_light_label"/>
<field name="bar" required="True"/>
</div>
<div class="row">
<label for="foo" class="col-lg-4 o_light_label"/>
<field name="foo"/>
</div>
</div>
```
becomes
```xml
<group>
<field name="bar" required="True"/>
<field name="foo"/>
</group>
```
task-id: 3081367
Co-authored-by: "Michael Mattiello (mcm)" <mcm@odoo.com>
Community : https://github.com/odoo/odoo/pull/106425Cancelled manufacturing orders can now be returned to draft, giving teams a way to correct or reuse orders instead of recreating them. This also supports changing the product on a confirmed manufacturing order by moving it back to draft, updating it, and confirming it again.
Original PR description
After this commit, we can now reset a cancelled MO to draft. We can also change the product_id of a confirmed MO. The way we do it is first reset it to draft, then we make the change, then confirm it again. Task 2278147 COM PR odoo/odoo#55837