[IMP] base_sequence_default: better readme

Fixes https://github.com/OCA/server-tools/issues/2769

@moduon MT-4324

Co-authored-by: Gelo Joga <147538094+Gelojr@users.noreply.github.com>
pull/2770/head
Jairo Llopis 2023-11-29 09:19:42 +00:00
parent 590cf43c30
commit c48052b309
No known key found for this signature in database
GPG Key ID: E47E3BE44B940490
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 !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:46bd6b862d7ba13aade25e32561797314eacd98aabe5af22479e59e95bd4fc59
!! source digest: sha256:ff7d3aed37cb25905d2a42e95caa5434fd63ca836b1f894f53a8435b5454a489
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
@ -28,8 +28,11 @@ Default Fields with Sequence
|badge1| |badge2| |badge3| |badge4| |badge5|
This module extends the defaults functionality to allow filling
*Character* type fields on creation with a predefined sequence.
This module extends the use of sequences. It will allow you to use them
in any text field.
If configured correctly, new records will have a default incremental
value in the field of your choice.
.. IMPORTANT::
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:
1. Enable developer mode.
2. Go to the form view of the model to which you want to add the new
sequential default value.
3. Hover over the field to which you want to add the sequential default
value. A tooltip with more info will appear.
4. Make sure the tooltip says *Type: char*. Only those fields will work.
5. Take note of the *Object* and *Field*.
6. Go to *Settings > Technical > Sequences & Identifiers > Sequences*.
7. Create one sequence with code named after this pattern:
``base_sequence_default.{object}.fields.{field}``. E.g.:
``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.
.. 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
=====
To use this module, it is necessary to:
1. Follow the configuration instructions.
2. Create a record of the model you configured.
3. Leave empty the fields where you configured a sequence. If they are
required fields, set value to "-" to trigger the automatic sequence
on creation.
4. Check that the field defined in the sequence is set to the next value
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
===========

View File

@ -12,6 +12,11 @@ To configure this module, you need to:
Sequences*.
7. Create one sequence with code named after this pattern:
`base_sequence_default.{object}.fields.{field}`. E.g.:
`base_sequence_default.res.partner.fields.name` to add a default
sequenced name for new partners.
`base_sequence_default.res.partner.fields.name` to add a default sequenced
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.
![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
*Character* type fields on creation with a predefined sequence.
This module extends the use of sequences. It will allow you to use them in any text
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.
4. Check that the field defined in the sequence is set to the next
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 !!
!! 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>This module extends the defaults functionality to allow filling
<em>Character</em> type fields on creation with a predefined sequence.</p>
<p>This module extends the use of sequences. It will allow you to use them
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">
<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.
@ -395,33 +397,49 @@ Only for development or testing purpose, do not use in production.
<div class="section" id="configuration">
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
<p>To configure this module, you need to:</p>
<ol class="arabic simple">
<li>Enable developer mode.</li>
<li>Go to the form view of the model to which you want to add the new
sequential default value.</li>
<li>Hover over the field to which you want to add the sequential default
value. A tooltip with more info will appear.</li>
<li>Make sure the tooltip says <em>Type: char</em>. Only those fields will work.</li>
<li>Take note of the <em>Object</em> and <em>Field</em>.</li>
<li>Go to <em>Settings &gt; Technical &gt; Sequences &amp; Identifiers &gt; Sequences</em>.</li>
<li>Create one sequence with code named after this pattern:
<ol class="arabic">
<li><p class="first">Enable developer mode.</p>
</li>
<li><p class="first">Go to the form view of the model to which you want to add the new
sequential default value.</p>
</li>
<li><p class="first">Hover over the field to which you want to add the sequential default
value. A tooltip with more info will appear.</p>
</li>
<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">base_sequence_default.res.partner.fields.name</tt> to add a default
sequenced name for new partners.</li>
<li>Configure the sequence at will.</li>
sequenced name for new partners. Do not use <tt class="docutils literal">{}</tt> when adding the
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>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
<p>To use this module, it is necessary to:</p>
<ol class="arabic simple">
<li>Follow the configuration instructions.</li>
<li>Create a record of the model you configured.</li>
<li>Leave empty the fields where you configured a sequence. If they are
<ol class="arabic">
<li><p class="first">Follow the configuration instructions.</p>
</li>
<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
on creation.</li>
<li>Check that the field defined in the sequence is set to the next value
in the sequence.</li>
on creation.</p>
</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>
</div>
<div class="section" id="bug-tracker">