Merge PR #2770 into 16.0

Signed-off-by dreispt
pull/2790/head
OCA-git-bot 2023-12-09 15:24:09 +00:00
commit 313b2adbe5
5 changed files with 81 additions and 30 deletions

View File

@ -7,7 +7,7 @@ Default Fields with Sequence
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:46bd6b862d7ba13aade25e32561797314eacd98aabe5af22479e59e95bd4fc59 !! source digest: sha256:ff7d3aed37cb25905d2a42e95caa5434fd63ca836b1f894f53a8435b5454a489
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png .. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
@ -28,8 +28,11 @@ Default Fields with Sequence
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
This module extends the defaults functionality to allow filling This module extends the use of sequences. It will allow you to use them
*Character* type fields on creation with a predefined sequence. in any text field.
If configured correctly, new records will have a default incremental
value in the field of your choice.
.. IMPORTANT:: .. IMPORTANT::
This is an alpha version, the data model and design can change at any time without warning. This is an alpha version, the data model and design can change at any time without warning.
@ -47,32 +50,52 @@ Configuration
To configure this module, you need to: To configure this module, you need to:
1. Enable developer mode. 1. Enable developer mode.
2. Go to the form view of the model to which you want to add the new 2. Go to the form view of the model to which you want to add the new
sequential default value. sequential default value.
3. Hover over the field to which you want to add the sequential default 3. Hover over the field to which you want to add the sequential default
value. A tooltip with more info will appear. value. A tooltip with more info will appear.
4. Make sure the tooltip says *Type: char*. Only those fields will work. 4. Make sure the tooltip says *Type: char*. Only those fields will work.
5. Take note of the *Object* and *Field*. 5. Take note of the *Object* and *Field*.
6. Go to *Settings > Technical > Sequences & Identifiers > Sequences*. 6. Go to *Settings > Technical > Sequences & Identifiers > Sequences*.
7. Create one sequence with code named after this pattern: 7. Create one sequence with code named after this pattern:
``base_sequence_default.{object}.fields.{field}``. E.g.: ``base_sequence_default.{object}.fields.{field}``. E.g.:
``base_sequence_default.res.partner.fields.name`` to add a default ``base_sequence_default.res.partner.fields.name`` to add a default
sequenced name for new partners. sequenced name for new partners. Do not use ``{}`` when adding the
model and field name to the pattern.
.. image:: https://github.com/OCA/server-tools/assets/147538094/ebf4be69-85d4-4c28-a3ec-bbe930fd53cf
:alt: Setting the sequence code properly
8. Configure the sequence at will. 8. Configure the sequence at will.
.. image:: https://github.com/OCA/server-tools/assets/147538094/e3eb311b-738f-4fce-9af5-a1b592908704
:alt: Configuring a sequence to have date range sub-sequences
Usage Usage
===== =====
To use this module, it is necessary to: To use this module, it is necessary to:
1. Follow the configuration instructions. 1. Follow the configuration instructions.
2. Create a record of the model you configured. 2. Create a record of the model you configured.
3. Leave empty the fields where you configured a sequence. If they are 3. Leave empty the fields where you configured a sequence. If they are
required fields, set value to "-" to trigger the automatic sequence required fields, set value to "-" to trigger the automatic sequence
on creation. on creation.
4. Check that the field defined in the sequence is set to the next value 4. Check that the field defined in the sequence is set to the next value
in the sequence. in the sequence.
.. image:: https://github.com/OCA/server-tools/assets/147538094/82698762-6ac2-4ac0-89ba-7c9b32ea5909
:alt: The partner reference was auto-incremented as configured
Bug Tracker Bug Tracker
=========== ===========

View File

@ -12,6 +12,11 @@ To configure this module, you need to:
Sequences*. Sequences*.
7. Create one sequence with code named after this pattern: 7. Create one sequence with code named after this pattern:
`base_sequence_default.{object}.fields.{field}`. E.g.: `base_sequence_default.{object}.fields.{field}`. E.g.:
`base_sequence_default.res.partner.fields.name` to add a default `base_sequence_default.res.partner.fields.name` to add a default sequenced
sequenced name for new partners. name for new partners. Do not use `{}` when adding the model and field name
to the pattern.
![Setting the sequence code properly](https://github.com/OCA/server-tools/assets/147538094/ebf4be69-85d4-4c28-a3ec-bbe930fd53cf)
8. Configure the sequence at will. 8. Configure the sequence at will.
![Configuring a sequence to have date range sub-sequences](https://github.com/OCA/server-tools/assets/147538094/e3eb311b-738f-4fce-9af5-a1b592908704)

View File

@ -1,2 +1,5 @@
This module extends the defaults functionality to allow filling This module extends the use of sequences. It will allow you to use them in any text
*Character* type fields on creation with a predefined sequence. field.
If configured correctly, new records will have a default incremental value in the field
of your choice.

View File

@ -7,3 +7,5 @@ To use this module, it is necessary to:
on creation. on creation.
4. Check that the field defined in the sequence is set to the next 4. Check that the field defined in the sequence is set to the next
value in the sequence. value in the sequence.
![The partner reference was auto-incremented as configured](https://github.com/OCA/server-tools/assets/147538094/82698762-6ac2-4ac0-89ba-7c9b32ea5909)

View File

@ -367,11 +367,13 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:46bd6b862d7ba13aade25e32561797314eacd98aabe5af22479e59e95bd4fc59 !! source digest: sha256:ff7d3aed37cb25905d2a42e95caa5434fd63ca836b1f894f53a8435b5454a489
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Alpha" src="https://img.shields.io/badge/maturity-Alpha-red.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-tools/tree/16.0/base_sequence_default"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-base_sequence_default"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-tools&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p> <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Alpha" src="https://img.shields.io/badge/maturity-Alpha-red.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-tools/tree/16.0/base_sequence_default"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-base_sequence_default"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-tools&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module extends the defaults functionality to allow filling <p>This module extends the use of sequences. It will allow you to use them
<em>Character</em> type fields on creation with a predefined sequence.</p> in any text field.</p>
<p>If configured correctly, new records will have a default incremental
value in the field of your choice.</p>
<div class="admonition important"> <div class="admonition important">
<p class="first admonition-title">Important</p> <p class="first admonition-title">Important</p>
<p class="last">This is an alpha version, the data model and design can change at any time without warning. <p class="last">This is an alpha version, the data model and design can change at any time without warning.
@ -395,33 +397,49 @@ Only for development or testing purpose, do not use in production.
<div class="section" id="configuration"> <div class="section" id="configuration">
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1> <h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
<p>To configure this module, you need to:</p> <p>To configure this module, you need to:</p>
<ol class="arabic simple"> <ol class="arabic">
<li>Enable developer mode.</li> <li><p class="first">Enable developer mode.</p>
<li>Go to the form view of the model to which you want to add the new </li>
sequential default value.</li> <li><p class="first">Go to the form view of the model to which you want to add the new
<li>Hover over the field to which you want to add the sequential default sequential default value.</p>
value. A tooltip with more info will appear.</li> </li>
<li>Make sure the tooltip says <em>Type: char</em>. Only those fields will work.</li> <li><p class="first">Hover over the field to which you want to add the sequential default
<li>Take note of the <em>Object</em> and <em>Field</em>.</li> value. A tooltip with more info will appear.</p>
<li>Go to <em>Settings &gt; Technical &gt; Sequences &amp; Identifiers &gt; Sequences</em>.</li> </li>
<li>Create one sequence with code named after this pattern: <li><p class="first">Make sure the tooltip says <em>Type: char</em>. Only those fields will work.</p>
</li>
<li><p class="first">Take note of the <em>Object</em> and <em>Field</em>.</p>
</li>
<li><p class="first">Go to <em>Settings &gt; Technical &gt; Sequences &amp; Identifiers &gt; Sequences</em>.</p>
</li>
<li><p class="first">Create one sequence with code named after this pattern:
<tt class="docutils literal"><span class="pre">base_sequence_default.{object}.fields.{field}</span></tt>. E.g.: <tt class="docutils literal"><span class="pre">base_sequence_default.{object}.fields.{field}</span></tt>. E.g.:
<tt class="docutils literal">base_sequence_default.res.partner.fields.name</tt> to add a default <tt class="docutils literal">base_sequence_default.res.partner.fields.name</tt> to add a default
sequenced name for new partners.</li> sequenced name for new partners. Do not use <tt class="docutils literal">{}</tt> when adding the
<li>Configure the sequence at will.</li> model and field name to the pattern.</p>
<img alt="Setting the sequence code properly" src="https://github.com/OCA/server-tools/assets/147538094/ebf4be69-85d4-4c28-a3ec-bbe930fd53cf" />
</li>
<li><p class="first">Configure the sequence at will.</p>
<img alt="Configuring a sequence to have date range sub-sequences" src="https://github.com/OCA/server-tools/assets/147538094/e3eb311b-738f-4fce-9af5-a1b592908704" />
</li>
</ol> </ol>
</div> </div>
<div class="section" id="usage"> <div class="section" id="usage">
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1> <h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
<p>To use this module, it is necessary to:</p> <p>To use this module, it is necessary to:</p>
<ol class="arabic simple"> <ol class="arabic">
<li>Follow the configuration instructions.</li> <li><p class="first">Follow the configuration instructions.</p>
<li>Create a record of the model you configured.</li> </li>
<li>Leave empty the fields where you configured a sequence. If they are <li><p class="first">Create a record of the model you configured.</p>
</li>
<li><p class="first">Leave empty the fields where you configured a sequence. If they are
required fields, set value to “-” to trigger the automatic sequence required fields, set value to “-” to trigger the automatic sequence
on creation.</li> on creation.</p>
<li>Check that the field defined in the sequence is set to the next value </li>
in the sequence.</li> <li><p class="first">Check that the field defined in the sequence is set to the next value
in the sequence.</p>
<img alt="The partner reference was auto-incremented as configured" src="https://github.com/OCA/server-tools/assets/147538094/82698762-6ac2-4ac0-89ba-7c9b32ea5909" />
</li>
</ol> </ol>
</div> </div>
<div class="section" id="bug-tracker"> <div class="section" id="bug-tracker">