-
-
Notifications
You must be signed in to change notification settings - Fork 368
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
[16.0][ADD] account_analytic_document_date: New module account_analyt… #694
Open
BernatObrador
wants to merge
1
commit into
OCA:16.0
Choose a base branch
from
APSL:16.0-add-account_analytic_document_date
base: 16.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
============================== | ||
Account Analytic Document Date | ||
============================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:a744d1489a8640283abcaacbc6366a24199f447d5d46ba66ad30beefcebf542b | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
|
||
.. |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--analytic-lightgray.png?logo=github | ||
:target: https://github.com/OCA/account-analytic/tree/16.0/account_analytic_document_date | ||
:alt: OCA/account-analytic | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/account-analytic-16-0/account-analytic-16-0-account_analytic_document_date | ||
: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-analytic&target_branch=16.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
The module introduces a new field in the accounting records to specify | ||
the "Accrual Date" for income and expenses. This field is crucial for | ||
accurately tracking when the revenue or expense is earned or incurred, | ||
regardless of the invoice creation date. | ||
|
||
For instance, if an invoice is created in December but refers to sales | ||
made in November, the Accrual Date allows us to reflect this correctly | ||
in our accounting records. This ensures compliance with accrual-based | ||
accounting principles and provides better insights into the financial | ||
period to which transactions belong. | ||
|
||
This feature is particularly valuable for businesses that need to | ||
differentiate between the accounting period of transaction occurrence | ||
and the timing of document issuance. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Usage | ||
===== | ||
|
||
1. **Set Document Date on Invoice:** | ||
|
||
- Navigate to the invoice and set the document date. | ||
- If the document date is not set, it will automatically be assigned | ||
the invoice date upon confirmation. | ||
|
||
2. **Analytic Line Generation:** | ||
|
||
- If any line has analytic information, the generated analytic entry | ||
will inherit the document date. | ||
|
||
3. **Setting Document Date in Reconcile View:** | ||
|
||
- You can also set the document date from the reconciliation view, | ||
but this option is available only during manual reconciliation. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-analytic/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-analytic/issues/new?body=module:%20account_analytic_document_date%0Aversion:%2016.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 | ||
------- | ||
|
||
* (Nagarro - APSL) | ||
|
||
Contributors | ||
------------ | ||
|
||
- ``APSL - Nagarro <https://apsl.tech>``\ \_\_: | ||
|
||
- Miquel Pascual | ||
- Bernat Obrador | ||
|
||
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-mpascual, BernatObrador| image:: https://github.com/mpascual, BernatObrador.png?size=40px | ||
:target: https://github.com/mpascual, BernatObrador | ||
:alt: mpascual, BernatObrador | ||
|
||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: | ||
|
||
|maintainer-mpascual, BernatObrador| | ||
|
||
This module is part of the `OCA/account-analytic <https://github.com/OCA/account-analytic/tree/16.0/account_analytic_document_date>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import models | ||
from .hooks import post_init_hook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright 2024 (APSL - Nagarro) Miquel Pascual, Bernat Obrador | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
{ | ||
"name": "Account Analytic Document Date", | ||
"summary": "Account Analytic Document Date", | ||
"version": "16.0.1.0.0", | ||
"website": "https://github.com/OCA/account-analytic", | ||
"author": ("(Nagarro - APSL), Odoo Community Association (OCA)"), | ||
"maintainers": ["mpascual, BernatObrador"], | ||
"license": "AGPL-3", | ||
"application": False, | ||
"installable": True, | ||
"depends": ["account", "account_reconcile_oca"], | ||
"data": [ | ||
"views/account_analytic_line_views.xml", | ||
"views/account_bank_statement_line_views.xml", | ||
"views/account_move.xml", | ||
], | ||
"post_init_hook": "post_init_hook", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Copyright 2024 (APSL - Nagarro) Miquel Pascual, Bernat Obrador | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
|
||
def post_init_hook(cr, registry): | ||
cr.execute( | ||
""" | ||
UPDATE account_move | ||
SET document_date = invoice_date | ||
WHERE document_date IS NULL | ||
""" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * account_analytic_document_date | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-09-27 10:33+0000\n" | ||
"PO-Revision-Date: 2024-09-27 10:33+0000\n" | ||
"Last-Translator: \n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: account_analytic_document_date | ||
#: model:ir.model,name:account_analytic_document_date.model_account_analytic_line | ||
msgid "Analytic Line" | ||
msgstr "Línia analítica" | ||
|
||
#. module: account_analytic_document_date | ||
#: model:ir.model,name:account_analytic_document_date.model_account_bank_statement_line | ||
msgid "Bank Statement Line" | ||
msgstr "Línea d'extracte bancari" | ||
|
||
#. module: account_analytic_document_date | ||
#: model:ir.model.fields,field_description:account_analytic_document_date.field_account_analytic_line__document_date | ||
#: model:ir.model.fields,field_description:account_analytic_document_date.field_account_bank_statement_line__document_date | ||
#: model:ir.model.fields,field_description:account_analytic_document_date.field_account_move__document_date | ||
#: model:ir.model.fields,field_description:account_analytic_document_date.field_account_payment__document_date | ||
msgid "Document Date" | ||
msgstr "Data del Document" | ||
|
||
#. module: account_analytic_document_date | ||
#: model:ir.model,name:account_analytic_document_date.model_account_move | ||
msgid "Journal Entry" | ||
msgstr "Assentament comptable" | ||
|
||
#. module: account_analytic_document_date | ||
#: model:ir.model,name:account_analytic_document_date.model_account_move_line | ||
msgid "Journal Item" | ||
msgstr "Element del diari" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * account_analytic_document_date | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-09-27 10:29+0000\n" | ||
"PO-Revision-Date: 2024-09-27 10:29+0000\n" | ||
"Last-Translator: \n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: account_analytic_document_date | ||
#: model:ir.model,name:account_analytic_document_date.model_account_analytic_line | ||
msgid "Analytic Line" | ||
msgstr "Línea analítica" | ||
|
||
#. module: account_analytic_document_date | ||
#: model:ir.model,name:account_analytic_document_date.model_account_bank_statement_line | ||
msgid "Bank Statement Line" | ||
msgstr "Línea de extracto bancario" | ||
|
||
#. module: account_analytic_document_date | ||
#: model:ir.model.fields,field_description:account_analytic_document_date.field_account_analytic_line__document_date | ||
#: model:ir.model.fields,field_description:account_analytic_document_date.field_account_bank_statement_line__document_date | ||
#: model:ir.model.fields,field_description:account_analytic_document_date.field_account_move__document_date | ||
#: model:ir.model.fields,field_description:account_analytic_document_date.field_account_payment__document_date | ||
msgid "Document Date" | ||
msgstr "Fecha del Documento" | ||
|
||
#. module: account_analytic_document_date | ||
#: model:ir.model,name:account_analytic_document_date.model_account_move | ||
msgid "Journal Entry" | ||
msgstr "Asiento contable" | ||
|
||
#. module: account_analytic_document_date | ||
#: model:ir.model,name:account_analytic_document_date.model_account_move_line | ||
msgid "Journal Item" | ||
msgstr "Apunte contable" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from . import account_move_line | ||
from . import account_analytic_line | ||
from . import account_move | ||
from . import account_bank_statement_line |
9 changes: 9 additions & 0 deletions
9
account_analytic_document_date/models/account_analytic_line.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Copyright 2024 (APSL - Nagarro) Miquel Pascual, Bernat Obrador | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
from odoo import fields, models | ||
|
||
|
||
class AccountAnalyticLine(models.Model): | ||
_inherit = "account.analytic.line" | ||
|
||
document_date = fields.Date() |
17 changes: 17 additions & 0 deletions
17
account_analytic_document_date/models/account_bank_statement_line.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright 2024 (APSL - Nagarro) Miquel Pascual, Bernat Obrador | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
from odoo import fields, models | ||
|
||
|
||
class AccountBankStatementLine(models.Model): | ||
_inherit = "account.bank.statement.line" | ||
|
||
document_date = fields.Date( | ||
"Document Date", related="move_id.document_date", readonly=False | ||
) | ||
|
||
def reconcile_bank_line(self): | ||
self.ensure_one() | ||
res = super().reconcile_bank_line() | ||
self.move_id.document_date = self.document_date | ||
return res | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright 2024 (APSL - Nagarro) Miquel Pascual, Bernat Obrador | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
from odoo import api, fields, models | ||
|
||
|
||
class AccountMove(models.Model): | ||
_inherit = "account.move" | ||
|
||
document_date = fields.Date() | ||
|
||
@api.onchange("invoice_date") | ||
def _onchange_invoice_date(self): | ||
for record in self: | ||
if not record.document_date: | ||
record.document_date = record.invoice_date | ||
|
||
def action_post(self): | ||
res = super().action_post() | ||
for record in self: | ||
if not record.document_date: | ||
record.document_date = record.invoice_date | ||
return res |
16 changes: 16 additions & 0 deletions
16
account_analytic_document_date/models/account_move_line.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright 2024 (APSL - Nagarro) Miquel Pascual, Bernat Obrador | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
from odoo import models | ||
|
||
|
||
class AccountMoveLine(models.Model): | ||
_inherit = "account.move.line" | ||
|
||
def _prepare_analytic_lines(self): | ||
vals = super()._prepare_analytic_lines() | ||
for val in vals: | ||
if self.move_id.document_date: | ||
val.update({"document_date": self.move_id.document_date}) | ||
else: | ||
val.update({"document_date": self.move_id.invoice_date}) | ||
return vals |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- `APSL - Nagarro <https://apsl.tech>`__: | ||
|
||
- Miquel Pascual | ||
- Bernat Obrador |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
The module introduces a new field in the accounting records to specify the "Accrual Date" for income and expenses. This field is crucial for accurately tracking when the revenue or expense is earned or incurred, regardless of the invoice creation date. | ||
|
||
For instance, if an invoice is created in December but refers to sales made in November, the Accrual Date allows us to reflect this correctly in our accounting records. This ensures compliance with accrual-based accounting principles and provides better insights into the financial period to which transactions belong. | ||
|
||
This feature is particularly valuable for businesses that need to differentiate between the accounting period of transaction occurrence and the timing of document issuance. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
1. **Set Document Date on Invoice:** | ||
- Navigate to the invoice and set the document date. | ||
- If the document date is not set, it will automatically be assigned the invoice date upon confirmation. | ||
|
||
2. **Analytic Line Generation:** | ||
- If any line has analytic information, the generated analytic entry will inherit the document date. | ||
|
||
3. **Setting Document Date in Reconcile View:** | ||
- You can also set the document date from the reconciliation view, but this option is available only during manual reconciliation. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's a date only for analytic, it shouldn't be called
document_date
, butanalytic_document_date
oranalytic_date
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, it is used for analytic purposes, but it is also visible in the account module, so it serves both purposes. For this reason, I believe the name 'document_date' remains appropriate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it creates confusion on users thinking that date is going to be used for example for financial reports. It should be renamed to
analytic_document_date
IMO.