diff --git a/account_move_name_sequence/README.rst b/account_move_name_sequence/README.rst index 07ddb3255..8811eb96f 100644 --- a/account_move_name_sequence/README.rst +++ b/account_move_name_sequence/README.rst @@ -98,7 +98,7 @@ 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 additionnal option to have another sequence dedicated to refunds. +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. @@ -126,6 +126,7 @@ Contributors * Alexis de Lattre * Moisés López +* Francisco Luna Maintainers ~~~~~~~~~~~ @@ -146,10 +147,13 @@ promote its widespread use. .. |maintainer-moylop260| image:: https://github.com/moylop260.png?size=40px :target: https://github.com/moylop260 :alt: moylop260 +.. |maintainer-frahikLV| image:: https://github.com/frahikLV.png?size=40px + :target: https://github.com/frahikLV + :alt: frahikLV Current `maintainers `__: -|maintainer-alexis-via| |maintainer-moylop260| +|maintainer-alexis-via| |maintainer-moylop260| |maintainer-frahikLV| This module is part of the `OCA/account-financial-tools `_ project on GitHub. diff --git a/account_move_name_sequence/__manifest__.py b/account_move_name_sequence/__manifest__.py index 1f2f54aa5..46ab257aa 100644 --- a/account_move_name_sequence/__manifest__.py +++ b/account_move_name_sequence/__manifest__.py @@ -2,18 +2,21 @@ # Copyright 2022 Vauxoo (https://www.vauxoo.com/) # @author: Alexis de Lattre # @author: Moisés López +# @author: Francisco Luna # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { "name": "Account Move Number Sequence", - "version": "14.0.1.2.1", + "version": "14.0.1.2.2", "category": "Accounting", "license": "AGPL-3", "summary": "Generate journal entry number from sequence", "author": "Akretion,Vauxoo,Odoo Community Association (OCA)", - "maintainers": ["alexis-via", "moylop260"], + "maintainers": ["alexis-via", "moylop260", "frahikLV"], "website": "https://github.com/OCA/account-financial-tools", - "depends": ["account"], + "depends": [ + "account", + ], "data": [ "views/account_journal.xml", "views/account_move.xml", diff --git a/account_move_name_sequence/models/account_journal.py b/account_move_name_sequence/models/account_journal.py index 740e01e94..41755ee1e 100644 --- a/account_move_name_sequence/models/account_journal.py +++ b/account_move_name_sequence/models/account_journal.py @@ -6,8 +6,6 @@ import logging -from dateutil.relativedelta import relativedelta - from odoo import _, api, fields, models from odoo.exceptions import ValidationError @@ -222,7 +220,7 @@ class AccountJournal(models.Model): year = "20" + year if month: date_from = fields.Date.to_date("%s-%s-1" % (year, month)) - date_to = date_from + relativedelta(day=31) + date_to = fields.Date.end_of(date_from, "month") else: date_from = fields.Date.to_date("%s-1-1" % year) date_to = fields.Date.to_date("%s-12-31" % year) diff --git a/account_move_name_sequence/models/ir_sequence.py b/account_move_name_sequence/models/ir_sequence.py index c7ee985f6..7dc7d2656 100644 --- a/account_move_name_sequence/models/ir_sequence.py +++ b/account_move_name_sequence/models/ir_sequence.py @@ -1,5 +1,3 @@ -from dateutil.relativedelta import relativedelta - from odoo import fields, models @@ -12,17 +10,18 @@ class IrSequence(models.Model): # TODO: Remove if odoo merge the following PR: # https://github.com/odoo/odoo/pull/91019 date_obj = fields.Date.from_string(date) + sequence_range = self.env["ir.sequence.date_range"] prefix_suffix = "%s %s" % (self.prefix, self.suffix) if "%(range_day)s" in prefix_suffix: date_from = date_obj date_to = date_obj elif "%(range_month)s" in prefix_suffix: - date_from = date_obj + relativedelta(day=1) - date_to = date_obj + relativedelta(day=31) + date_from = fields.Date.start_of(date_obj, "month") + date_to = fields.Date.end_of(date_obj, "month") else: - date_from = date_obj + relativedelta(day=1, month=1) - date_to = date_obj + relativedelta(day=31, month=12) - date_range = self.env["ir.sequence.date_range"].search( + date_from = fields.Date.start_of(date_obj, "year") + date_to = fields.Date.end_of(date_obj, "year") + date_range = sequence_range.search( [ ("sequence_id", "=", self.id), ("date_from", ">=", date), @@ -32,8 +31,8 @@ class IrSequence(models.Model): limit=1, ) if date_range: - date_to = date_range.date_from + relativedelta(days=-1) - date_range = self.env["ir.sequence.date_range"].search( + date_to = fields.Date.subtract(date_range.date_from, days=1) + date_range = sequence_range.search( [ ("sequence_id", "=", self.id), ("date_to", ">=", date_from), @@ -43,16 +42,11 @@ class IrSequence(models.Model): limit=1, ) if date_range: - date_from = date_range.date_to + relativedelta(days=1) - seq_date_range = ( - self.env["ir.sequence.date_range"] - .sudo() - .create( - { - "date_from": date_from, - "date_to": date_to, - "sequence_id": self.id, - } - ) - ) + date_to = fields.Date.add(date_range.date_to, days=1) + sequence_range_vals = { + "date_from": date_from, + "date_to": date_to, + "sequence_id": self.id, + } + seq_date_range = sequence_range.sudo().create(sequence_range_vals) return seq_date_range diff --git a/account_move_name_sequence/readme/CONFIGURE.rst b/account_move_name_sequence/readme/CONFIGURE.rst index b2998870a..830a5389e 100644 --- a/account_move_name_sequence/readme/CONFIGURE.rst +++ b/account_move_name_sequence/readme/CONFIGURE.rst @@ -1,5 +1,5 @@ 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 additionnal option to have another sequence dedicated to refunds. +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. diff --git a/account_move_name_sequence/readme/CONTRIBUTORS.rst b/account_move_name_sequence/readme/CONTRIBUTORS.rst index c3f907014..3e8712428 100644 --- a/account_move_name_sequence/readme/CONTRIBUTORS.rst +++ b/account_move_name_sequence/readme/CONTRIBUTORS.rst @@ -1,2 +1,3 @@ * Alexis de Lattre * Moisés López +* Francisco Luna diff --git a/account_move_name_sequence/static/description/index.html b/account_move_name_sequence/static/description/index.html index 1f7fcb013..14a7905a9 100644 --- a/account_move_name_sequence/static/description/index.html +++ b/account_move_name_sequence/static/description/index.html @@ -440,7 +440,7 @@ And even if you must use no-gap in your company or country it will reduce the co

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 additionnal option to have another sequence dedicated to refunds.

+

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.

@@ -465,6 +465,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
@@ -475,7 +476,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome mission is to support the collaborative development of Odoo features and promote its widespread use.

Current maintainers:

-

alexis-via moylop260

+

alexis-via moylop260 frahikLV

This module is part of the OCA/account-financial-tools project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/account_move_name_sequence/views/account_journal.xml b/account_move_name_sequence/views/account_journal.xml index d274975a6..e0a28adc1 100644 --- a/account_move_name_sequence/views/account_journal.xml +++ b/account_move_name_sequence/views/account_journal.xml @@ -2,6 +2,8 @@ diff --git a/account_move_name_sequence/views/account_move.xml b/account_move_name_sequence/views/account_move.xml index cb9457315..2536e9066 100644 --- a/account_move_name_sequence/views/account_move.xml +++ b/account_move_name_sequence/views/account_move.xml @@ -10,23 +10,21 @@ account.move - - {'invisible': [('name', '=', '/')]} - - {'invisible': [('name', '=', '/')]} + + - {'readonly': 1} - - + {'readonly': 1} + + {'invisible': 1} - +