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

[18.0][MIG] account_move_name_sequence migration to 18.0 #1954

Open
wants to merge 61 commits into
base: 18.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
c50765f
Add module account_move_name_sequence
alexis-via Sep 6, 2021
1ae219a
sequence is now required on journals
alexis-via Sep 8, 2021
a510629
[REF] account_move_name_sequence: Add number_next_actual and date ran…
moylop260 May 5, 2022
32f606f
[FIX] ir_sequence: Fix creating date_range_seq with range_month and r…
moylop260 May 10, 2022
2a182c7
[REF] account_move_name_sequence: Discard journals already configured
moylop260 May 11, 2022
2696fce
[FIX] account_move_name_sequence: Fix sequence domain to assign only …
moylop260 May 13, 2022
0790697
[REF] account_move_name_sequence: Moves with name '/' can not be posted
moylop260 May 13, 2022
895854b
[FIX] account_move_name_sequence: Fix required journal fields in view
moylop260 May 13, 2022
0af3675
[REF] account_move_name_sequence: Add maintainers to myself
moylop260 May 13, 2022
73f29a4
[REF] account_move_name_sequence: Adding concurrency cases in README
moylop260 May 19, 2022
516922a
[REF] account_move_name_sequence: Use Odoo native methods + Typos
frahikLV May 26, 2022
051f2c3
[MIG] account_move_name_sequence: Migration to 15.0
frahikLV May 26, 2022
a7ec93e
[FIX] account_move_name_sequence: Exclude no_gap sequences from _is_e…
frahikLV May 25, 2022
f7c1edc
[FIX] account_move_name_sequence: Use account move date to compute pr…
petrus-v Jul 7, 2022
e48e096
[MIG] account_move_name_sequence: Migration to 16.0
RodrigoBM Nov 24, 2022
50e1b28
[FIX] account_move_name_sequence: return sequence names do not add a …
RodrigoBM Nov 24, 2022
75af231
[FIX] account_move_name_sequence: issue #1465 vals get refund_sequenc…
RodrigoBM Nov 28, 2022
84b46cc
[FIX] account_move_name_sequence: call flush before _fetch_duplicate_…
RodrigoBM Dec 2, 2022
07afa3e
[REF] account_move_name_sequence: Remove concurrency outdated cases f…
moylop260 Dec 8, 2022
e910c59
[FIX] account_move_name_sequence: With the "account_move_name_sequenc…
RodrigoBM Jan 20, 2023
6c2ec90
[FIX] account_move_name_sequence: Now you can unlink moves without ch…
RodrigoBM Jan 31, 2023
b4fd6ce
Added translation using Weblate (Croatian)
badbole Feb 11, 2023
d1b3ff7
[FIX] account_move_name_sequence: computed fields raising warning
remi-filament Mar 15, 2023
0a67e62
Added translation using Weblate (French)
remi-filament Apr 4, 2023
dea1659
Added translation using Weblate (Spanish)
Gelo-fl Apr 13, 2023
4109098
Translated using Weblate (French)
Jun 8, 2023
4542112
[FIX] account_move_name_sequence: do not create duplicated sequences
astirpe Aug 24, 2023
21549eb
Added translation using Weblate (Arabic)
hussain Aug 29, 2023
c56d8d0
[REF] account_move_name_sequence: rename hooks file
andreagidaltig Oct 8, 2023
fb92b1c
[FIX] account_move_name_sequence: call _inverse_name after computing …
BT-anieto Oct 11, 2023
d36a95b
[IMP] account_move_name_sequence: pre-commit stuff
moitabenfdz Nov 13, 2023
27bc5d0
[MIG] account_move_name_sequence: Migration to 17.0
moitabenfdz Nov 13, 2023
02dd952
[UPD] Update account_move_name_sequence.pot
Mar 28, 2024
c1c7976
[BOT] post-merge updates
OCA-git-bot Mar 28, 2024
128ad67
Added translation using Weblate (Italian)
mymage Apr 2, 2024
0852aed
Translated using Weblate (Italian)
mymage Apr 2, 2024
dda8370
[FIX] account_move_name_sequence: redefine _onchange_journal_id
mde-scopea Oct 26, 2023
362e3a6
[FIX] account_move_name_sequence: call flush before to post the moves
fernandahf Nov 30, 2022
4728e23
[REF] account_move_name_sequence: Added concurrency tests related to …
payen000 Aug 9, 2022
ab74fd1
[FIX] account_move_name_sequence: avoid fallback on odoo sequence name
petrus-v Mar 27, 2023
898eb01
Added translation using Weblate (Slovenian)
sysadminmatmoz Mar 30, 2023
db6064a
[IMP] account_move_name_sequence: pre-commit auto fixes
moylop260 Apr 8, 2024
d070e8a
[FW] account_move_name_sequence: Forward-Port of 14.0 to 15.0
moylop260 Apr 8, 2024
6957931
[FW] account_move_name_sequence: Forward-Port of 15.0 to 16.0
moylop260 Apr 17, 2024
8c81bf9
[IMP] account_move_name_sequence: pre-commit auto fixes
moylop260 Apr 17, 2024
0797831
[BOT] post-merge updates
OCA-git-bot Apr 17, 2024
c363a1c
[REF] account_move_name_sequence: Check invoice name based on journal…
ljsalvatierra-factorlibre Apr 17, 2024
b702e05
[BOT] post-merge updates
OCA-git-bot Apr 17, 2024
81c2912
fix: account_move_name_sequence: tests: Listen to exceptions for each…
Tardo Apr 22, 2024
e31cb3e
[BOT] post-merge updates
OCA-git-bot Apr 22, 2024
1a56f59
[REF] account_move_name_sequence: Add unittest to create concurrency …
moylop260 Apr 22, 2024
2d65516
[UPD] Update account_move_name_sequence.pot
Apr 23, 2024
66dc006
[BOT] post-merge updates
OCA-git-bot Apr 23, 2024
e2c637f
[IMP] account_move_name_sequence: split too long context definition
andreagidaltig Oct 28, 2023
aff79e6
[IMP] account_move_name_sequence: apply guidelines to name view files
andreagidaltig Oct 27, 2023
388c8ae
[BOT] post-merge updates
OCA-git-bot Apr 23, 2024
2d69f68
Update translation files
weblate Apr 23, 2024
ec65b06
Translated using Weblate (Italian)
mymage Apr 23, 2024
8034e42
Translated using Weblate (Spanish)
Ivorra78 Apr 24, 2024
adfdf38
[IMP] account_move_name_sequence: pre-commit stuff
BertVGroenendael Oct 16, 2024
598e640
[18.0][MIG] account_move_name_sequence: Migration to 18.0
BertVGroenendael Oct 21, 2024
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 @@
============================
Account Move Number Sequence
============================

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

.. |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/licence-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/18.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-18-0/account-financial-tools-18-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=18.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:%2018.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]>

- `Dynapps <https://www.dynapps.eu>`__:

- Bert Van Groenendael <[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/18.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": "18.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">True</field>
<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">True</field>
<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">1</field>
<field name="number_increment">1</field>
<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">1</field>
<field name="number_increment">1</field>
<field name="company_id" ref="base.main_company" />
<field name="implementation">standard</field>
</record>
</odoo>
33 changes: 33 additions & 0 deletions account_move_name_sequence/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# 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).


def post_init_hook(env):
create_journal_sequences(env)


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
Loading