-
-
Notifications
You must be signed in to change notification settings - Fork 55
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] l10n_nl_tax_statement_date_range #380
Merged
OCA-git-bot
merged 1 commit into
OCA:16.0
from
onesteinbv:16_add_l10n_nl_tax_statement_date_range
Feb 12, 2024
Merged
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,84 @@ | ||
====================================== | ||
Netherlands BTW Statement - Date range | ||
====================================== | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
|
||
.. |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%2Fl10n--netherlands-lightgray.png?logo=github | ||
:target: https://github.com/OCA/l10n-netherlands/tree/16.0/l10n_nl_tax_statement_date_range | ||
:alt: OCA/l10n-netherlands | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/l10n-netherlands-16-0/l10n-netherlands-16-0-l10n_nl_tax_statement_date_range | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png | ||
:target: https://runbot.odoo-community.org/runbot/176/16.0 | ||
:alt: Try me on Runbot | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module provides the "Netherlands BTW Statement" with the Date Range feature. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Installation | ||
============ | ||
|
||
* This module is installed automatically in case both ``l10n_nl_tax_statement`` and ``date_range`` are installed. | ||
|
||
Usage | ||
===== | ||
|
||
When creating a statement you can select a date range: the fields | ||
``From Date`` and ``To Date`` will be automatically set. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-netherlands/issues>`_. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us smashing it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/l10n-netherlands/issues/new?body=module:%20l10n_nl_tax_statement_date_range%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 | ||
~~~~~~~ | ||
|
||
* Onestein | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Andrea Stirpe <[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. | ||
|
||
This module is part of the `OCA/l10n-netherlands <https://github.com/OCA/l10n-netherlands/tree/16.0/l10n_nl_tax_statement_date_range>`_ 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 @@ | ||
from . import models |
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 2023 Onestein (<https://www.onestein.eu>) | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Netherlands BTW Statement - Date range", | ||
"version": "16.0.1.0.0", | ||
"category": "Localization", | ||
"license": "AGPL-3", | ||
"author": "Onestein, Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/l10n-netherlands", | ||
"depends": ["l10n_nl_tax_statement", "date_range"], | ||
"data": [ | ||
"views/l10n_nl_vat_statement_view.xml", | ||
], | ||
"installable": True, | ||
"auto_install": True, | ||
} |
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 @@ | ||
from . import l10n_nl_vat_statement |
20 changes: 20 additions & 0 deletions
20
l10n_nl_tax_statement_date_range/models/l10n_nl_vat_statement.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,20 @@ | ||
# Copyright 2023 Onestein (<https://www.onestein.eu>) | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class VatStatement(models.Model): | ||
_inherit = "l10n.nl.vat.statement" | ||
|
||
date_range_id = fields.Many2one("date.range", "Date range") | ||
|
||
@api.onchange("date_range_id") | ||
def onchange_date_range_id(self): | ||
if self.date_range_id and self.state == "draft": | ||
self.update( | ||
{ | ||
"from_date": self.date_range_id.date_start, | ||
"to_date": self.date_range_id.date_end, | ||
} | ||
) |
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 @@ | ||
* Andrea Stirpe <[email protected]> |
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 @@ | ||
This module provides the "Netherlands BTW Statement" with the Date Range feature. |
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 @@ | ||
* This module is installed automatically in case both ``l10n_nl_tax_statement`` and ``date_range`` are installed. |
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 @@ | ||
When creating a statement you can select a date range: the fields | ||
``From Date`` and ``To Date`` will be automatically set. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 @@ | ||
from . import test_l10n_nl_vat_statement |
57 changes: 57 additions & 0 deletions
57
l10n_nl_tax_statement_date_range/tests/test_l10n_nl_vat_statement.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,57 @@ | ||
# Copyright 2023 Onestein (<https://www.onestein.eu>) | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
|
||
import datetime | ||
|
||
from odoo.tests import Form | ||
|
||
from odoo.addons.l10n_nl_tax_statement.tests.test_l10n_nl_vat_statement import ( | ||
TestVatStatement, | ||
) | ||
|
||
|
||
class TestTaxStatementIcp(TestVatStatement): | ||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
daterange_type = cls.env["date.range.type"].create({"name": "Type 1"}) | ||
daterange_vals = { | ||
"name": "Daterange 1", | ||
"type_id": daterange_type.id, | ||
"date_start": "2016-01-01", | ||
"date_end": "2016-12-31", | ||
} | ||
cls.daterange = cls.env["date.range"].create(daterange_vals) | ||
|
||
def test_01_date_range(self): | ||
"""When setting the Date Range, the From Date and To Date are updated accordingly""" | ||
self.assertEqual(self.statement_1.state, "draft") | ||
self.assertNotEqual(self.statement_1.from_date, datetime.date(2016, 1, 1)) | ||
self.assertNotEqual(self.statement_1.to_date, datetime.date(2016, 12, 31)) | ||
|
||
# setting the date range modifies the From Date and To Date | ||
form = Form(self.statement_1) | ||
form.date_range_id = self.daterange | ||
form.save() | ||
self.assertEqual(self.statement_1.from_date, datetime.date(2016, 1, 1)) | ||
self.assertEqual(self.statement_1.to_date, datetime.date(2016, 12, 31)) | ||
|
||
# removing the date range doesn't affect the From Date and To Date | ||
form = Form(self.statement_1) | ||
form.date_range_id = self.env["date.range"] | ||
form.save() | ||
self.assertEqual(self.statement_1.from_date, datetime.date(2016, 1, 1)) | ||
self.assertEqual(self.statement_1.to_date, datetime.date(2016, 12, 31)) | ||
|
||
def test_02_date_range(self): | ||
"""Setting the Date Range is allowed only when the statement is in draft""" | ||
self.statement_1.statement_update() | ||
self.statement_1.post() | ||
self.assertEqual(self.statement_1.state, "posted") | ||
self.assertNotEqual(self.statement_1.from_date, datetime.date(2016, 1, 1)) | ||
self.assertNotEqual(self.statement_1.to_date, datetime.date(2016, 12, 31)) | ||
|
||
# setting the date range is not allowed | ||
form = Form(self.statement_1) | ||
with self.assertRaises(AssertionError): | ||
form.date_range_id = self.daterange |
18 changes: 18 additions & 0 deletions
18
l10n_nl_tax_statement_date_range/views/l10n_nl_vat_statement_view.xml
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,18 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<record id="view_l10n_nl_vat_report_form" model="ir.ui.view"> | ||
<field name="model">l10n.nl.vat.statement</field> | ||
<field | ||
name="inherit_id" | ||
ref="l10n_nl_tax_statement.view_l10n_nl_vat_report_form" | ||
/> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//label[@for='from_date']" position="before"> | ||
<field | ||
name="date_range_id" | ||
attrs="{'readonly': [('state','in',['posted','final'])]}" | ||
/> | ||
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |
1 change: 1 addition & 0 deletions
1
setup/l10n_nl_tax_statement_date_range/odoo/addons/l10n_nl_tax_statement_date_range
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 @@ | ||
../../../../l10n_nl_tax_statement_date_range |
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,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |
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.
Maybe set from_date and to_date to readonly if date range selected?