mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[REF] account_move_name_sequence: Use Odoo native methods + Typos
This commit is contained in:
committed by
Marcos Oitaben
parent
262262ee97
commit
425e29ba2d
@@ -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 <alexis.delattre@akretion.com>
|
||||
* Moisés López <moylop260@vauxoo.com>
|
||||
* Francisco Luna <fluna@vauxoo.com>
|
||||
|
||||
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 <https://odoo-community.org/page/maintainer-role>`__:
|
||||
|
||||
|maintainer-alexis-via| |maintainer-moylop260|
|
||||
|maintainer-alexis-via| |maintainer-moylop260| |maintainer-frahikLV|
|
||||
|
||||
This module is part of the `OCA/account-financial-tools <https://github.com/OCA/account-financial-tools/tree/14.0/account_move_name_sequence>`_ project on GitHub.
|
||||
|
||||
|
||||
@@ -2,18 +2,21 @@
|
||||
# Copyright 2022 Vauxoo (https://www.vauxoo.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# @author: Moisés López <moylop260@vauxoo.com>
|
||||
# @author: Francisco Luna <fluna@vauxoo.com>
|
||||
# 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",
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
* Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
* Moisés López <moylop260@vauxoo.com>
|
||||
* Francisco Luna <fluna@vauxoo.com>
|
||||
|
||||
@@ -440,7 +440,7 @@ And even if you must use no-gap in your company or country it will reduce the co
|
||||
<div class="section" id="configuration">
|
||||
<h1><a class="toc-backref" href="#id2">Configuration</a></h1>
|
||||
<p>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.</p>
|
||||
<p>On sale and purchase journals, you have an additionnal option to have another sequence dedicated to refunds.</p>
|
||||
<p>On sale and purchase journals, you have an additional option to have another sequence dedicated to refunds.</p>
|
||||
<p>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 <em>Dedicated Credit Note Sequence</em> 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.</p>
|
||||
</div>
|
||||
<div class="section" id="bug-tracker">
|
||||
@@ -465,6 +465,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||
<ul class="simple">
|
||||
<li>Alexis de Lattre <<a class="reference external" href="mailto:alexis.delattre@akretion.com">alexis.delattre@akretion.com</a>></li>
|
||||
<li>Moisés López <<a class="reference external" href="mailto:moylop260@vauxoo.com">moylop260@vauxoo.com</a>></li>
|
||||
<li>Francisco Luna <<a class="reference external" href="mailto:fluna@vauxoo.com">fluna@vauxoo.com</a>></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
@@ -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.</p>
|
||||
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p>
|
||||
<p><a class="reference external" href="https://github.com/alexis-via"><img alt="alexis-via" src="https://github.com/alexis-via.png?size=40px" /></a> <a class="reference external" href="https://github.com/moylop260"><img alt="moylop260" src="https://github.com/moylop260.png?size=40px" /></a></p>
|
||||
<p><a class="reference external" href="https://github.com/alexis-via"><img alt="alexis-via" src="https://github.com/alexis-via.png?size=40px" /></a> <a class="reference external" href="https://github.com/moylop260"><img alt="moylop260" src="https://github.com/moylop260.png?size=40px" /></a> <a class="reference external" href="https://github.com/frahikLV"><img alt="frahikLV" src="https://github.com/frahikLV.png?size=40px" /></a></p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-financial-tools/tree/14.0/account_move_name_sequence">OCA/account-financial-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>
|
||||
</div>
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
<!--
|
||||
Copyright 2021 Akretion France (http://www.akretion.com/)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
@author: Moisés López <moylop260@vauxoo.com>
|
||||
@author: Francisco Luna <fluna@vauxoo.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
<odoo>
|
||||
|
||||
@@ -10,23 +10,21 @@
|
||||
<field name="model">account.move</field>
|
||||
<field name="inherit_id" ref="account.view_move_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath
|
||||
<xpath
|
||||
expr="//div[hasclass('oe_title')]/h1[hasclass('mt0')]"
|
||||
position="attributes"
|
||||
>
|
||||
<attribute
|
||||
name="attrs"
|
||||
>{'invisible': [('name', '=', '/')]}</attribute>
|
||||
</xpath>
|
||||
<xpath
|
||||
<attribute name="attrs">{'invisible': [('name', '=', '/')]}</attribute>
|
||||
</xpath>
|
||||
<xpath
|
||||
expr="//div[hasclass('oe_title')]//field[@name='name']"
|
||||
position="attributes"
|
||||
>
|
||||
<attribute name="attrs">{'readonly': 1}</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='highest_name']/.." position="attributes">
|
||||
<attribute name="attrs">{'readonly': 1}</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='highest_name']/.." position="attributes">
|
||||
<attribute name="attrs">{'invisible': 1}</attribute>
|
||||
</xpath>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user