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

[ADD] account_tax_lock_group #1987

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
100 changes: 100 additions & 0 deletions account_tax_lock_group/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
==================
Account Lock Group
==================

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

.. |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/16.0/account_tax_lock_group
: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-16-0/account-financial-tools-16-0-account_tax_lock_group
: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=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

If a user is in the group "Update tax lock date without restrictions", they can update the "Tax Return Lock Date" (`tax_lock_date`) without raising any exception.

Updating such date is usually restricted for a good reason, so update it at your own risk.

**Table of contents**

.. contents::
:local:

Configuration
=============

Add the user to group "Update tax lock date without restrictions".

Usage
=====

Account lock dates can be updated from the User Interface using the OCA module `account_lock_date_update` or the Enterprise module `account_accountant`.

The added group allows to edit the "Tax Return Lock Date" only when it is the only date being modified.

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_tax_lock_group%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
~~~~~~~

* Aion Tech

Contributors
~~~~~~~~~~~~

* `Aion Tech <https://aiontech.company/>`_:

* Simone Rubino <[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-SirAionTech| image:: https://github.com/SirAionTech.png?size=40px
:target: https://github.com/SirAionTech
:alt: SirAionTech

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-SirAionTech|

This module is part of the `OCA/account-financial-tools <https://github.com/OCA/account-financial-tools/tree/16.0/account_tax_lock_group>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions account_tax_lock_group/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import models
20 changes: 20 additions & 0 deletions account_tax_lock_group/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2024 Simone Rubino - Aion Tech
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Account Lock Group",
"summary": "Account lock dates can be updated without restrictions by a dedicated group.",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "Aion Tech, Odoo Community Association (OCA)",
"maintainers": [
"SirAionTech",
],
"website": "https://github.com/OCA/account-financial-tools",
"depends": [
"account_lock",
],
"data": [
"security/res_company_security.xml",
],
}
26 changes: 26 additions & 0 deletions account_tax_lock_group/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_tax_lock_group
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-12 13:19+0000\n"
"PO-Revision-Date: 2024-12-12 13:19+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_tax_lock_group
#: model:ir.model,name:account_tax_lock_group.model_res_company
msgid "Companies"
msgstr "Aziende"

#. module: account_tax_lock_group
#: model:res.groups,name:account_tax_lock_group.account_tax_lock_date_group_manager
msgid "Update tax lock date without restrictions"
msgstr "Aggiornare la data di blocco in contabilità senza restrizioni"
3 changes: 3 additions & 0 deletions account_tax_lock_group/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import res_company
31 changes: 31 additions & 0 deletions account_tax_lock_group/models/res_company.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2024 Simone Rubino - Aion Tech
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).


from odoo import models


class ResCompany(models.Model):
_inherit = "res.company"

def _autorise_lock_date_changes(self, vals):
if self.user_has_groups(
"account_tax_lock_group.account_tax_lock_date_group_manager",
):
# Check that only the "Tax Return Lock Date" is being modified
check_vals = vals.copy()
lock_date_fields = [
"period_lock_date",
"fiscalyear_lock_date",
"tax_lock_date",
]
for lock_date_field in lock_date_fields:
if check_vals.get(lock_date_field) == self.env.company[lock_date_field]:
check_vals.pop(lock_date_field)

Check warning on line 24 in account_tax_lock_group/models/res_company.py

View check run for this annotation

Codecov / codecov/patch

account_tax_lock_group/models/res_company.py#L24

Added line #L24 was not covered by tests

if set(check_vals.keys()) == {"tax_lock_date"}:
# Only the "Tax Return Lock Date" is being modified
# and the user can modify it.
pass
else:
return super()._autorise_lock_date_changes(vals)
1 change: 1 addition & 0 deletions account_tax_lock_group/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add the user to group "Update tax lock date without restrictions".
3 changes: 3 additions & 0 deletions account_tax_lock_group/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `Aion Tech <https://aiontech.company/>`_:

* Simone Rubino <[email protected]>
3 changes: 3 additions & 0 deletions account_tax_lock_group/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
If a user is in the group "Update tax lock date without restrictions", they can update the "Tax Return Lock Date" (`tax_lock_date`) without raising any exception.

Updating such date is usually restricted for a good reason, so update it at your own risk.
3 changes: 3 additions & 0 deletions account_tax_lock_group/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Account lock dates can be updated from the User Interface using the OCA module `account_lock_date_update` or the Enterprise module `account_accountant`.

The added group allows to edit the "Tax Return Lock Date" only when it is the only date being modified.
17 changes: 17 additions & 0 deletions account_tax_lock_group/security/res_company_security.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
~ Copyright 2024 Simone Rubino - Aion Tech
~ License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
-->
<odoo noupdate="1">
<record id="account_tax_lock_date_group_manager" model="res.groups">
<field name="name">Update tax lock date without restrictions</field>
<field name="category_id" ref="base.module_category_accounting_accounting" />
<field
name="implied_ids"
eval="[
Command.link(ref('account.group_account_manager')),
]"
/>
</record>
</odoo>
Loading
Loading