@ -0,0 +1,50 @@ |
|||
.. image:: https://img.shields.io/badge/license-LGPL--3-green.svg |
|||
:target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html |
|||
:alt: License: LGPL-3 |
|||
|
|||
Restrict Journal for Users |
|||
========================== |
|||
* This module helps to restrict journal for the specific users.Users can access allowed journals only |
|||
|
|||
Configuration |
|||
============= |
|||
* No additional configuration required |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
License |
|||
------- |
|||
General Public License, Version 3 (LGPL v3). |
|||
(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) |
|||
|
|||
Credits |
|||
------- |
|||
* Developer:(V16) Sreeshanth V S, |
|||
(V17) Ashwin A, |
|||
(V18) Mufeeda Shirin , |
|||
* Contact: odoo@cybrosys.com |
|||
|
|||
Contacts |
|||
-------- |
|||
* Mail Contact : odoo@cybrosys.com |
|||
* Website : https://cybrosys.com |
|||
|
|||
Bug Tracker |
|||
----------- |
|||
Bugs are tracked on GitHub Issues. In case of trouble, please check there if |
|||
your issue has already been reported. |
|||
|
|||
Maintainer |
|||
========== |
|||
.. image:: https://cybrosys.com/images/logo.png |
|||
:target: https://cybrosys.com |
|||
|
|||
This module is maintained by Cybrosys Technologies. |
|||
|
|||
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
|||
|
|||
Further information |
|||
=================== |
|||
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from . import models |
|||
from . import wizard |
@ -0,0 +1,45 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
{ |
|||
'name': "Restrict Journal for Users", |
|||
"version": "18.0.1.0.0", |
|||
"category": "Accounting ", |
|||
"summary": "User can select only allowed journals", |
|||
"description": """ Restrict account journal for the specific users to |
|||
access allowed journals only""", |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': "https://www.cybrosys.com", |
|||
'depends': ['base', 'account'], |
|||
'data': [ |
|||
'security/account_restrict_journal_groups.xml', |
|||
'security/account_move_security.xml', |
|||
'views/res_users_views.xml', |
|||
'views/account_move_views.xml' |
|||
], |
|||
'images': ['static/description/banner.png'], |
|||
'license': 'LGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': False, |
|||
} |
@ -0,0 +1,7 @@ |
|||
## Module <account_restrict_journal> |
|||
|
|||
#### 15.03.2025 |
|||
#### Version 18.0.1.0.0 |
|||
##### ADD |
|||
- Initial Commit for Restrict Journal for Users |
|||
|
@ -0,0 +1,24 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from . import account_move |
|||
from . import account_payment |
|||
from . import res_users |
@ -0,0 +1,53 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import api, fields, models, _ |
|||
from odoo.exceptions import ValidationError |
|||
|
|||
|
|||
class AccountMove(models.Model): |
|||
"""Inherited model for checking the journal type in account.move.""" |
|||
_inherit = 'account.move' |
|||
|
|||
is_check_journal = fields.Boolean(string="Check Journal", |
|||
help="Compute field for check the " |
|||
"current record's journal type ", |
|||
compute="_compute_is_check_journal") |
|||
|
|||
def _compute_is_check_journal(self): |
|||
"""Compute field for showing validation error for restricted journal's |
|||
records""" |
|||
for rec in self: |
|||
rec.is_check_journal = True |
|||
for line in rec.line_ids: |
|||
if line.full_reconcile_id: |
|||
payment = self.env['account.payment.register'].search( |
|||
[('id', '=', line.full_reconcile_id.id)]) |
|||
if payment.journal_id.id in rec.env.user.journal_ids.ids: |
|||
raise ValidationError(_('Restricted journals found.')) |
|||
if rec.journal_id.id in rec.env.user.journal_ids.ids: |
|||
raise ValidationError(_('Restricted journals found.')) |
|||
|
|||
@api.onchange('partner_id') |
|||
def _onchange_partner_id(self): |
|||
"""Function for hiding restricted journals from account.move.""" |
|||
if self.journal_id.id in self.env.user.journal_ids.ids: |
|||
self.journal_id = False |
@ -0,0 +1,52 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import api, models, _ |
|||
from odoo.exceptions import ValidationError |
|||
|
|||
|
|||
class AccountPayment(models.Model): |
|||
"""Inherits the model account.payment to add Validation Error for |
|||
Restricted Journals""" |
|||
_inherit = 'account.payment' |
|||
|
|||
@api.model_create_multi |
|||
def create(self, vals): |
|||
"""Super Create Method for Restricted journals""" |
|||
res = super(AccountPayment, self).create(vals) |
|||
for val in vals: |
|||
if int(val['journal_id']) in self.env.user.journal_ids.ids: |
|||
raise ValidationError( |
|||
_('You are restricted to create payment with this journal') |
|||
) |
|||
else: |
|||
return res |
|||
|
|||
def write(self, vals): |
|||
"""Super Write Method for Restricted journals""" |
|||
if vals.get('journal_id'): |
|||
journal_id = int(vals['journal_id']) |
|||
if journal_id in self.env.user.journal_ids.ids: |
|||
raise ValidationError( |
|||
_('You are restricted to modify payment with this journal') |
|||
) |
|||
return super().write(vals) |
|||
|
@ -0,0 +1,51 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class ResUsers(models.Model): |
|||
""" Adding journal fields where we can select allowed journal """ |
|||
_inherit = 'res.users' |
|||
|
|||
is_check_user = fields.Boolean(string="Check", |
|||
compute='_compute_is_check_user', |
|||
help="Check the field is true or false") |
|||
journal_ids = fields.Many2many( |
|||
'account.journal', |
|||
string='Restricted Journals', |
|||
help='Only the selected journal will be visible' |
|||
' to the particular user') |
|||
|
|||
def _compute_is_check_user(self): |
|||
"""Compute the is_check_user field and |
|||
clear journal_ids if necessary.""" |
|||
for user in self: |
|||
admin_group = user.env.ref( |
|||
'account_restrict_journal.account_restrict_journal_group_admin' |
|||
).id |
|||
user_groups = user.groups_id.mapped('id') |
|||
|
|||
if admin_group in user_groups: |
|||
user.is_check_user = True |
|||
else: |
|||
user.is_check_user = False |
|||
user.journal_ids = False |
@ -0,0 +1,60 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!-- Created new record rule for created user group Except the Restricted journals--> |
|||
<record id="account_journal_rule_users" model="ir.rule"> |
|||
<field name="name">Account Journal Restrict on Users</field> |
|||
<field name="model_id" ref="account.model_account_journal"/> |
|||
<field name="domain_force">[('id','not in', user.journal_ids.ids)] |
|||
</field> |
|||
<field name="groups" |
|||
eval="[(4, ref('account_restrict_journal.account_restrict_journal_group_admin'))]"/> |
|||
<field name="perm_read" eval="True"/> |
|||
<field name="perm_write" eval="True"/> |
|||
<field name="perm_create" eval="True"/> |
|||
<field name="perm_unlink" eval="True"/> |
|||
<field name="active" eval="True"/> |
|||
</record> |
|||
<!-- Created new record rule for user group only for the Restricted journals--> |
|||
<record id="account_restricted_journal_rule_users" model="ir.rule"> |
|||
<field name="name">Account Restricted Journals on Users</field> |
|||
<field name="model_id" ref="account.model_account_journal"/> |
|||
<field name="domain_force">[('id','in', user.journal_ids.ids)] |
|||
</field> |
|||
<field name="groups" |
|||
eval="[(4, ref('account_restrict_journal.account_restrict_journal_group_admin'))]"/> |
|||
<field name="perm_read" eval="True"/> |
|||
<field name="perm_write" eval="False"/> |
|||
<field name="perm_create" eval="False"/> |
|||
<field name="perm_unlink" eval="False"/> |
|||
<field name="active" eval="True"/> |
|||
</record> |
|||
<!-- Created new record rule for user group Except for the Restricted journals in Payment--> |
|||
<record id="account_payment_rule_users" model="ir.rule"> |
|||
<field name="name">Account Payment Restrict on Users</field> |
|||
<field name="model_id" ref="account.model_account_payment"/> |
|||
<field name="domain_force">[('journal_id','not in', |
|||
user.journal_ids.ids)] |
|||
</field> |
|||
<field name="groups" |
|||
eval="[(4, ref('account_restrict_journal.account_restrict_journal_group_admin'))]"/> |
|||
<field name="perm_read" eval="True"/> |
|||
<field name="perm_write" eval="True"/> |
|||
<field name="perm_create" eval="True"/> |
|||
<field name="perm_unlink" eval="True"/> |
|||
<field name="active" eval="True"/> |
|||
</record> |
|||
<!-- Created new record rule for user group Only for the Restricted journals in Payment--> |
|||
<record id="account_payments_restricted_rule_users" model="ir.rule"> |
|||
<field name="name">Account Payment Restrict journals on Users</field> |
|||
<field name="model_id" ref="account.model_account_payment"/> |
|||
<field name="domain_force">[('journal_id','in', user.journal_ids.ids)] |
|||
</field> |
|||
<field name="groups" |
|||
eval="[(4, ref('account_restrict_journal.account_restrict_journal_group_admin'))]"/> |
|||
<field name="perm_read" eval="True"/> |
|||
<field name="perm_write" eval="False"/> |
|||
<field name="perm_create" eval="True"/> |
|||
<field name="perm_unlink" eval="False"/> |
|||
<field name="active" eval="True"/> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,8 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!-- New user group created for journal restriction--> |
|||
<record id="account_restrict_journal_group_admin" model="res.groups"> |
|||
<field name="name">Restrict Journals</field> |
|||
<field name="category_id" ref="base.module_category_usability"/> |
|||
</record> |
|||
</odoo> |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 628 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 738 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 126 KiB |
After Width: | Height: | Size: 86 KiB |
After Width: | Height: | Size: 90 KiB |
After Width: | Height: | Size: 118 KiB |
After Width: | Height: | Size: 142 KiB |
After Width: | Height: | Size: 138 KiB |
After Width: | Height: | Size: 213 KiB |
After Width: | Height: | Size: 90 KiB |
After Width: | Height: | Size: 70 KiB |
After Width: | Height: | Size: 86 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 118 KiB |
After Width: | Height: | Size: 91 KiB |
After Width: | Height: | Size: 71 KiB |
After Width: | Height: | Size: 182 KiB |
After Width: | Height: | Size: 880 KiB |
After Width: | Height: | Size: 90 KiB |
After Width: | Height: | Size: 8.9 KiB |
@ -0,0 +1,18 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!-- Added fields for check journal type --> |
|||
<record id="view_move_form" model="ir.ui.view"> |
|||
<field name="name">account.move.form.inherit.account.restrict.journal</field> |
|||
<field name="model">account.move</field> |
|||
<field name="mode">extension</field> |
|||
<field name="inherit_id" ref="account.view_move_form"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//group[@id='header_right_group']" position="inside"> |
|||
<field name="is_check_journal" invisible="1"/> |
|||
<field name="journal_id" |
|||
options="{'no_create': True}" |
|||
readonly="state != 'draft'"/> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,20 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!-- Added fields for accessible journals --> |
|||
<record id="view_users_form" model="ir.ui.view"> |
|||
<field name="name">res.users.form.inherit.account.restrict.journal</field> |
|||
<field name="model">res.users</field> |
|||
<field name="mode">extension</field> |
|||
<field name="inherit_id" ref="base.view_users_form"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//page[@name='account_security']" position="after"> |
|||
<page name="account_journal" string="Restricted Journal" invisible="not is_check_user" > |
|||
<group> |
|||
<field name="journal_ids" widget="many2many_tags"/> |
|||
<field name="is_check_user" invisible="1"/> |
|||
</group> |
|||
</page> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from . import account_payment_register |