Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
4c90e9e
Add module account_move_name_sequence
alexis-via Sep 6, 2021
a1ddd04
sequence is now required on journals
alexis-via Sep 8, 2021
21448f5
[REF] account_move_name_sequence: Add number_next_actual and date ran…
moylop260 May 5, 2022
ed40f61
[FIX] ir_sequence: Fix creating date_range_seq with range_month and r…
moylop260 May 10, 2022
eb2533f
[REF] account_move_name_sequence: Discard journals already configured
moylop260 May 11, 2022
f5bc4bc
[FIX] account_move_name_sequence: Fix sequence domain to assign only …
moylop260 May 13, 2022
54cddb7
[REF] account_move_name_sequence: Moves with name '/' can not be posted
moylop260 May 13, 2022
e6f8198
[FIX] account_move_name_sequence: Fix required journal fields in view
moylop260 May 13, 2022
a8a7f53
[REF] account_move_name_sequence: Add maintainers to myself
moylop260 May 13, 2022
7c2b1f5
[REF] account_move_name_sequence: Adding concurrency cases in README
moylop260 May 19, 2022
bb974cb
[REF] account_move_name_sequence: Use Odoo native methods + Typos
frahikLV May 26, 2022
18ef8f2
[MIG] account_move_name_sequence: Migration to 15.0
frahikLV May 26, 2022
3ea1f07
[FIX] account_move_name_sequence: Exclude no_gap sequences from _is_e…
frahikLV May 25, 2022
0784dd4
[FIX] account_move_name_sequence: Use account move date to compute pr…
petrus-v Jul 7, 2022
47481d1
[MIG] account_move_name_sequence: Migration to 16.0
RodrigoBM Nov 24, 2022
a2cbd32
[FIX] account_move_name_sequence: return sequence names do not add a …
RodrigoBM Nov 24, 2022
45e4ea2
[FIX] account_move_name_sequence: issue #1465 vals get refund_sequenc…
RodrigoBM Nov 28, 2022
91de5f1
[FIX] account_move_name_sequence: call flush before _fetch_duplicate_…
RodrigoBM Dec 2, 2022
6314ef0
[REF] account_move_name_sequence: Remove concurrency outdated cases f…
moylop260 Dec 8, 2022
df2f6bf
[FIX] account_move_name_sequence: With the "account_move_name_sequenc…
RodrigoBM Jan 20, 2023
7608a4c
[FIX] account_move_name_sequence: Now you can unlink moves without ch…
RodrigoBM Jan 31, 2023
e8678d6
Added translation using Weblate (Croatian)
badbole Feb 11, 2023
d485697
[FIX] account_move_name_sequence: computed fields raising warning
remi-filament Mar 15, 2023
761254a
Added translation using Weblate (French)
remi-filament Apr 4, 2023
3fd1b66
Added translation using Weblate (Spanish)
Gelo-fl Apr 13, 2023
865b71f
Translated using Weblate (French)
Jun 8, 2023
40b077a
[FIX] account_move_name_sequence: do not create duplicated sequences
astirpe Aug 24, 2023
e78bcc5
Added translation using Weblate (Arabic)
hussain Aug 29, 2023
4963d3c
[REF] account_move_name_sequence: rename hooks file
andreagidaltig Oct 8, 2023
9297422
[FIX] account_move_name_sequence: call _inverse_name after computing …
BT-anieto Oct 11, 2023
35d4d29
[IMP] account_move_name_sequence: pre-commit stuff
moitabenfdz Nov 13, 2023
16ad151
[MIG] account_move_name_sequence: Migration to 17.0
moitabenfdz Nov 13, 2023
81af3fb
Added translation using Weblate (Italian)
mymage Apr 2, 2024
2a13045
[FIX] account_move_name_sequence: redefine _onchange_journal_id
mide-dynapps Oct 26, 2023
cf48e84
[FIX] account_move_name_sequence: call flush before to post the moves
fernandahf Nov 30, 2022
e45b084
[REF] account_move_name_sequence: Added concurrency tests related to …
payen000 Aug 9, 2022
148219d
[FIX] account_move_name_sequence: avoid fallback on odoo sequence name
petrus-v Mar 27, 2023
8f313fb
Added translation using Weblate (Slovenian)
sysadminmatmoz Mar 30, 2023
0fa8592
[IMP] account_move_name_sequence: pre-commit auto fixes
moylop260 Apr 8, 2024
faa291a
[FW] account_move_name_sequence: Forward-Port of 14.0 to 15.0
moylop260 Apr 8, 2024
5559d88
[FW] account_move_name_sequence: Forward-Port of 15.0 to 16.0
moylop260 Apr 17, 2024
8bb1b6f
[IMP] account_move_name_sequence: pre-commit auto fixes
moylop260 Apr 17, 2024
3ed02de
[REF] account_move_name_sequence: Check invoice name based on journal…
ljsalvatierra-factorlibre Apr 17, 2024
08e402d
fix: account_move_name_sequence: tests: Listen to exceptions for each…
Tardo Apr 22, 2024
2e369f3
[REF] account_move_name_sequence: Add unittest to create concurrency …
moylop260 Apr 22, 2024
58be579
[IMP] account_move_name_sequence: split too long context definition
andreagidaltig Oct 28, 2023
d436aae
[IMP] account_move_name_sequence: apply guidelines to name view files
andreagidaltig Oct 27, 2023
e2d56c3
Update translation files
weblate Apr 23, 2024
bf856df
[IMP] account_move_name_sequence: pre-commit auto fixes
CLaurelB Jan 29, 2025
c89936f
[IMP] account_move_name_sequence: manual lints fixes
CLaurelB Jan 29, 2025
f3546f8
[MIG] account_move_name_sequence: Migrate to v18.0
CLaurelB Jan 29, 2025
c76bc74
[IMP] account_move_name_sequence: refactor tests and improve field ha…
CLaurelB Jan 29, 2025
5a09b0f
Update translation files
weblate Jan 29, 2025
a11296b
[FIX] account_move_name_sequence: Registry cleanup
houzefa-abba May 21, 2025
646d268
Added translation using Weblate (Portuguese (Brazil))
marcelsavegnago Jun 24, 2025
56bc7e7
[FIX] account_move_name_sequence: set sequence prefix and number for …
remi-filament Oct 14, 2025
4e60f8c
Update translation files
weblate Oct 14, 2025
fe5c274
[MIG] account_move_name_sequence: Migrate to 19.0
RyanTranAVB Nov 27, 2025
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
163 changes: 163 additions & 0 deletions account_move_name_sequence/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

============================
Account Move Number Sequence
============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:0c2654e763b1efefa3bdde71142ff86c5b15b5bc1ade423a7b2af05b98a17c2d
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github
:target: https://github.com/OCA/account-financial-tools/tree/19.0/account_move_name_sequence
:alt: OCA/account-financial-tools
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-financial-tools-19-0/account-financial-tools-19-0-account_move_name_sequence
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-financial-tools&target_branch=19.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

In Odoo version 13.0 and previous versions, the number of journal
entries was generated from a sequence configured on the journal.

In Odoo version 14.0, the number of journal entries can be manually set
by the user. Then, the number attributed for the next journal entries in
the same journal is computed by a complex piece of code that guesses the
format of the journal entry number from the number of the journal entry
which was manually entered by the user. It has several drawbacks:

- the available options for the sequence are limited,
- it is not possible to configure the sequence in advance before the
deployment in production,
- as it is error-prone, they added a *Resequence* wizard to re-generate
the journal entry numbers, which can be considered as illegal in many
countries,
- the `piece of
code <https://github.com/odoo/odoo/blob/14.0/addons/account/models/sequence_mixin.py>`__
that handles this is not easy to understand and quite difficult to
debug.

Using this module, you can configure what kind of documents the gap
sequence may be relaxed And even if you must use no-gap in your company
or country it will reduce the concurrency issues since the module is
using an extra table (ir_sequence) instead of locking the last record

For those like me who think that the implementation before Odoo v14.0
was much better, for the accountants who think it should not be possible
to manually enter the sequence of a customer invoice, for the auditor
who considers that resequencing journal entries is prohibited by law,
this module may be a solution to get out of the nightmare.

The field names used in this module to configure the sequence on the
journal are exactly the same as in Odoo version 13.0 and previous
versions. That way, if you migrate to Odoo version 14.0 and you install
this module immediately after the migration, you should keep the
previous behavior and the same sequences will continue to be used.

The module removes access to the *Resequence* wizard on journal entries.

**Table of contents**

.. contents::
:local:

Configuration
=============

On the form view of an account journal, in the first tab, there is a
many2one link to the sequence. When you create a new journal, you can
keep this field empty and a new sequence will be automatically created
when you save the journal.

On sale and purchase journals, you have an additional option to have
another sequence dedicated to refunds.

Upon module installation, all existing journals will be updated with a
journal entry sequence (and also a credit note sequence for sale and
purchase journals). You should update the configuration of the sequences
to fit your needs. You can uncheck the option *Dedicated Credit Note
Sequence* on existing sale and purchase journals if you don't want it.
For the journals which already have journal entries, you should update
the sequence configuration to avoid a discontinuity in the numbering for
the next journal entry.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-financial-tools/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_move_name_sequence%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Akretion
* Vauxoo

Contributors
------------

- `Akretion <https://www.akretion.com>`__:

- Alexis de Lattre <[email protected]>

- `Vauxoo <https://www.vauxoo.com>`__:

- Moisés López <[email protected]>
- Francisco Luna <[email protected]>

- `Factor Libre <https://www.factorlibre.com>`__:

- Rodrigo Bonilla Martinez <[email protected]>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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.

.. |maintainer-alexis-via| image:: https://github.com/alexis-via.png?size=40px
:target: https://github.com/alexis-via
:alt: alexis-via
.. |maintainer-moylop260| image:: https://github.com/moylop260.png?size=40px
:target: https://github.com/moylop260
:alt: moylop260
.. |maintainer-luisg123v| image:: https://github.com/luisg123v.png?size=40px
:target: https://github.com/luisg123v
:alt: luisg123v

Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-alexis-via| |maintainer-moylop260| |maintainer-luisg123v|

This module is part of the `OCA/account-financial-tools <https://github.com/OCA/account-financial-tools/tree/19.0/account_move_name_sequence>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions account_move_name_sequence/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from .hooks import post_init_hook
from . import models
31 changes: 31 additions & 0 deletions account_move_name_sequence/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2021 Akretion France (http://www.akretion.com/)
# Copyright 2022 Vauxoo (https://www.vauxoo.com/)
# @author: Alexis de Lattre <[email protected]>
# @author: Moisés López <[email protected]>
# @author: Francisco Luna <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Account Move Number Sequence",
"version": "19.0.1.0.0",
"category": "Accounting",
"license": "AGPL-3",
"summary": "Generate journal entry number from sequence",
"author": "Akretion,Vauxoo,Odoo Community Association (OCA)",
"maintainers": ["alexis-via", "moylop260", "luisg123v"],
"website": "https://github.com/OCA/account-financial-tools",
"depends": [
"account",
],
"demo": [
"demo/ir_sequence_demo.xml",
"demo/account_journal_demo.xml",
],
"data": [
"views/account_journal_views.xml",
"views/account_move_views.xml",
"security/ir.model.access.csv",
],
"post_init_hook": "post_init_hook",
"installable": True,
}
19 changes: 19 additions & 0 deletions account_move_name_sequence/demo/account_journal_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="journal_sale_std_demo" model="account.journal">
<field name="name">Standard Sale Journal Demo</field>
<field name="code">SSJD</field>
<field name="type">sale</field>
<field name="refund_sequence" eval="True" />
<field name="company_id" ref="base.main_company" />
<field name="sequence_id" ref="seq_sale_std_demo" />
</record>
<record id="journal_cash_std_demo" model="account.journal">
<field name="name">Standard Cash Journal Demo</field>
<field name="code">SCJD</field>
<field name="type">cash</field>
<field name="refund_sequence" eval="True" />
<field name="company_id" ref="base.main_company" />
<field name="sequence_id" ref="seq_cash_std_demo" />
</record>
</odoo>
21 changes: 21 additions & 0 deletions account_move_name_sequence/demo/ir_sequence_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="seq_sale_std_demo" model="ir.sequence">
<field name="name">Standard Sale Sequence Demo</field>
<field name="prefix">SSS_demo/%(range_year)s/</field>
<field name="use_date_range" eval="True" />
<field name="number_next" eval="1" />
<field name="number_increment" eval="1" />
<field name="company_id" ref="base.main_company" />
<field name="implementation">standard</field>
</record>
<record id="seq_cash_std_demo" model="ir.sequence">
<field name="name">Standard Cash Sequence Demo</field>
<field name="prefix">SCS_demo/%(range_year)s/</field>
<field name="use_date_range" eval="True" />
<field name="number_next" eval="1" />
<field name="number_increment" eval="1" />
<field name="company_id" ref="base.main_company" />
<field name="implementation">standard</field>
</record>
</odoo>
35 changes: 35 additions & 0 deletions account_move_name_sequence/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright 2021 Akretion France (http://www.akretion.com/)
# Copyright 2022 Vauxoo (https://www.vauxoo.com/)
# @author: Alexis de Lattre <[email protected]>
# @author: Moisés López <[email protected]>
# @author: Francisco Luna <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import tools


def post_init_hook(env):
create_journal_sequences(env)


@tools.mute_logger("odoo.addons.account_move_name_sequence.models.account_journal")
def create_journal_sequences(env):
journals = (
env["account.journal"]
.with_context(active_test=False)
.search([("sequence_id", "=", False)])
)
for journal in journals:
journal_vals = {
"code": journal.code,
"name": journal.name,
"company_id": journal.company_id.id,
}
seq_vals = journal._prepare_sequence(journal_vals)
seq_vals.update(journal._prepare_sequence_current_moves())
vals = {"sequence_id": env["ir.sequence"].create(seq_vals).id}
if journal.type in ("sale", "purchase") and journal.refund_sequence:
rseq_vals = journal._prepare_sequence(journal_vals, refund=True)
rseq_vals.update(journal._prepare_sequence_current_moves(refund=True))
vals["refund_sequence_id"] = env["ir.sequence"].create(rseq_vals).id
journal.write(vals)
return
Loading