Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syncing from upstream OCA/server-tools (16.0) #1374

Merged
merged 3 commits into from
Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ addon | version | maintainers | summary
[base_name_search_improved](base_name_search_improved/) | 16.0.1.0.0 | | Friendlier search when typing in relation fields
[base_partition](base_partition/) | 16.0.1.0.0 | | Base module that provide the partition method on all models
[base_search_fuzzy](base_search_fuzzy/) | 16.0.1.0.0 | | Fuzzy search with the PostgreSQL trigram extension
[base_sequence_default](base_sequence_default/) | 16.0.1.0.1 | [![Shide](https://github.com/Shide.png?size=30px)](https://github.com/Shide) [![yajo](https://github.com/yajo.png?size=30px)](https://github.com/yajo) [![rafaelbn](https://github.com/rafaelbn.png?size=30px)](https://github.com/rafaelbn) | Use sequences for default values of fields when creating a new record
[base_sequence_default](base_sequence_default/) | 16.0.1.0.2 | [![Shide](https://github.com/Shide.png?size=30px)](https://github.com/Shide) [![yajo](https://github.com/yajo.png?size=30px)](https://github.com/yajo) [![rafaelbn](https://github.com/rafaelbn.png?size=30px)](https://github.com/rafaelbn) | Use sequences for default values of fields when creating a new record
[base_sequence_option](base_sequence_option/) | 16.0.1.0.0 | [![kittiu](https://github.com/kittiu.png?size=30px)](https://github.com/kittiu) | Alternative sequence options for specific models
[base_sparse_field_list_support](base_sparse_field_list_support/) | 16.0.1.0.0 | | add list support to convert_to_cache()
[base_technical_user](base_technical_user/) | 16.0.1.0.0 | | Add a technical user parameter on the company
Expand Down
33 changes: 29 additions & 4 deletions base_sequence_default/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:30552d740f43d32a3643985156656c3d9917f363a22c3e46b3dc906cc2144d00
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
Expand All @@ -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.
Expand All @@ -47,32 +50,54 @@ 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.

|Setting the sequence code properly|

8. Configure the sequence at will.

|Configuring a sequence to have date range sub-sequences|

.. |Setting the sequence code properly| image:: https://github.com/OCA/server-tools/assets/147538094/ebf4be69-85d4-4c28-a3ec-bbe930fd53cf
.. |Configuring a sequence to have date range sub-sequences| image:: https://github.com/OCA/server-tools/assets/147538094/e3eb311b-738f-4fce-9af5-a1b592908704

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.

|The partner reference was auto-incremented as configured|

.. |The partner reference was auto-incremented as configured| image:: https://github.com/OCA/server-tools/assets/147538094/82698762-6ac2-4ac0-89ba-7c9b32ea5909

Bug Tracker
===========

Expand Down
2 changes: 1 addition & 1 deletion base_sequence_default/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"name": "Default Fields with Sequence",
"summary": "Use sequences for default values of fields when creating a new record",
"version": "16.0.1.0.1",
"version": "16.0.1.0.2",
"development_status": "Alpha",
"category": "Tools",
"website": "https://github.com/OCA/server-tools",
Expand Down
9 changes: 7 additions & 2 deletions base_sequence_default/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
7 changes: 5 additions & 2 deletions base_sequence_default/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 2 additions & 0 deletions base_sequence_default/readme/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
62 changes: 40 additions & 22 deletions base_sequence_default/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,13 @@ <h1 class="title">Default Fields with Sequence</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:46bd6b862d7ba13aade25e32561797314eacd98aabe5af22479e59e95bd4fc59
!! source digest: sha256:30552d740f43d32a3643985156656c3d9917f363a22c3e46b3dc906cc2144d00
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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.
Expand All @@ -395,33 +397,49 @@ <h1 class="title">Default Fields with Sequence</h1>
<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>
<p><img alt="Setting the sequence code properly" src="https://github.com/OCA/server-tools/assets/147538094/ebf4be69-85d4-4c28-a3ec-bbe930fd53cf" /></p>
</li>
<li><p class="first">Configure the sequence at will.</p>
<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" /></p>
</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>
<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" /></p>
</li>
</ol>
</div>
<div class="section" id="bug-tracker">
Expand Down
Loading