Search 1.9 billion lines of Odoo code on GitHub

sequence_python

Author: Sunflower IT,Odoo Community Association (OCA)
License: AGPL-3
Branch: 14.0
Repository: acsone/server-tools
Dependencies: base
Languages: HTML (364, 56.1%), PO File (62, 9.6%), Python (100, 15.4%), XML (52, 8.0%), and reStructuredText (71, 10.9%)
Other branches: 13.0, 13.0-bp-jsonifier-ape, 13.0-fix-cache-base_jsonify-ape, 13.0-fix-precommit-ape, 13.0-mig-request_auditor, 13.0-mig_auto_export, 13.0-session_db-sbi, 13.0-slg_master, 13.0-update-dotfiles-sbi, 14.0-mass_mailing_mail_server-mle, and 14.0-session_db-sbi
Other repositories: AITIC/server-tools, Callino/server-tools, Change2improve/server-tools, Digital5-Odoo/server-tools, Dobtor-OCA/server-tools, ForgeFlow/server-tools, Gabinete-Digital/server-tools, Jarsa/server-tools, LevelPrime/server-tools, NL66278/server-tools, OCA/server-tools, Rad0van/server-tools, StefanRijnhart/server-tools, TRESCLOUD/server-tools, Tecnativa/server-tools, Vauxoo/server-tools, YannickB/server-tools, adhoc-dev/server-tools, akretion/server-tools, anhvu-sg/server-tools, aurestic/server-tools, avoinsystems/server-tools, blooparksystems/server-tools, bmya/server-tools, brain-tec/server-tools, camptocamp/server-tools, coopiteasy/server-tools, ecosoft-odoo/server-tools, focusate/oca-server-tools, grindtildeath/server-tools, gurneyalex/server-tools, hbrunn/server-tools, hibou-io/oca-server-tools, initOS/server-tools, invitu/server-tools, kmee/server-tools, legalsylvain/server-tools, lonelyleaves/server-tools, modoolar/server-tools, nilshamerlinck/server-tools, ntsirintanis/server-tools, omalbastin/server-tools, petrus-v/server-tools, praxigento/oca-server-tools, rsullivan2704/server-tools, sodexis/server-tools, solvosci/server-tools, sunflowerit/server-tools, tafaRU/server-tools, tegin/server-tools, trevi-software/server-tools, unitek-solusi/OCA-server-tools, ursais/server-tools, versada/server-tools, xcgd/server-tools, ypapouin/server-tools, zarumaru/server-tools, and zhaohuaw/server-tools

<h1 class="title">Sequence from Python expression</h1> <p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" 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" href="https://github.com/OCA/server-tools/tree/14.0/sequence_python"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/server-tools-14-0/server-tools-14-0-sequence_python"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/149/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> <p>This module allows to generate a sequence by a Python formula expression.</p> <p>Besides common Python functions and operators, it provides several functions like 'random' and 'uuid' in the expression, as well as variables such as the next number in the sequence. These are also listed next to the input field on the sequence form view.</p> <p>If you want to add more variables for use in the expression, you can extend this module.</p> <p>Use cases for this module could be:</p> <ul class="simple"> <li>You want to generate alphanumeric numbering</li> <li>You want to apply some math to the number to prevent customers from knowing their place in the sequence</li> <li>You want to use UUID</li> </ul> <p><strong>Table of contents</strong></p> <div class="contents local topic" id="contents"> <ul class="simple"> <li><a class="reference internal" href="#usage" id="id1">Usage</a></li> <li><a class="reference internal" href="#bug-tracker" id="id2">Bug Tracker</a></li> <li><a class="reference internal" href="#credits" id="id3">Credits</a><ul> <li><a class="reference internal" href="#authors" id="id4">Authors</a></li> <li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li> <li><a class="reference internal" href="#maintainers" id="id6">Maintainers</a></li> </ul> </li> </ul> </div> <a name="usage"></a> <h2><a class="toc-backref" href="#id1">Usage</a></h2> <p>To use this module, you need to:</p> <ul class="simple"> <li>Go to the form view of an <cite>ir.sequence</cite> record</li> <li>Go to the Python tab</li> <li>Enable the 'Use Python' checkbox</li> <li>Change the default 'number' expression to something more fancy.</li> </ul> <p>Examples:</p> <pre> <code lang="python"># To separate the Odoo-generated number with hyphens eg. 0-0-0-0-1 '-'.join(number_padded) # To have an UUID as the sequence value uuid.uuid4().hex # To use an 8-digit binary number '{0:#010b}'.format(number + 300)[2:]</code> </pre> <p>And so on.</p> <a name="bug-tracker"></a> <h2><a class="toc-backref" href="#id2">Bug Tracker</a></h2> <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-tools/issues">GitHub Issues</a>. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed <a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20sequence_python%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <p>Do not contact contributors directly about support or help with technical issues.</p> <a name="credits"></a> <h2><a class="toc-backref" href="#id3">Credits</a></h2> <a name="authors"></a> <h3><a class="toc-backref" href="#id4">Authors</a></h3> <ul class="simple"> <li>Sunflower IT</li> </ul> <a name="contributors"></a> <h3><a class="toc-backref" href="#id5">Contributors</a></h3> <ul class="simple"> <li>Tom Blauwendraat &lt;<a class="reference external" href="mailto:tom&#64;sunflowerweb.nl">tom&#64;sunflowerweb.nl</a>&gt;</li> <li>Francesco Apruzzese &lt;<a class="reference external" href="mailto:cescoap&#64;gmail.com">cescoap&#64;gmail.com</a>&gt;</li> </ul> <a name="maintainers"></a> <h3><a class="toc-backref" href="#id6">Maintainers</a></h3> <p>This module is maintained by the OCA.</p> <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a> <p>OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.</p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-tools/tree/14.0/sequence_python">OCA/server-tools</a> project on GitHub.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>