diff --git a/account_restrict_journal/__manifest__.py b/account_restrict_journal/__manifest__.py index be3896b8c..e9b3b0e2e 100644 --- a/account_restrict_journal/__manifest__.py +++ b/account_restrict_journal/__manifest__.py @@ -21,7 +21,7 @@ ############################################################################# { 'name': "Restrict Journal for Users", - "version": "16.0.2.1.2", + "version": "16.0.2.1.1", "category": "Accounting", "summary": "User can select only allowed journals", "description": """ Restrict account journal for the specific users to @@ -30,7 +30,7 @@ 'company': 'Cybrosys Techno Solutions', 'maintainer': 'Cybrosys Techno Solutions', 'website': "https://www.cybrosys.com", - 'depends': ['base', 'account'], + 'depends': ['base','account'], 'data': [ 'security/account_journal_security.xml', 'security/ir_rule.xml', diff --git a/account_restrict_journal/doc/RELEASE_NOTES.md b/account_restrict_journal/doc/RELEASE_NOTES.md index 3c5c02713..0a28ae1ef 100644 --- a/account_restrict_journal/doc/RELEASE_NOTES.md +++ b/account_restrict_journal/doc/RELEASE_NOTES.md @@ -9,8 +9,3 @@ #### Version 16.0.2.1.1 #### UPDT - Bug Fix and Change Functionality - -#### 09.01.2024 -#### Version 16.0.2.1.2 -#### BUGFIX -- Solved the issue in enterprise and added extra conditions to validation error. diff --git a/account_restrict_journal/models/account_move.py b/account_restrict_journal/models/account_move.py index 31fd331e2..715a3c1bc 100644 --- a/account_restrict_journal/models/account_move.py +++ b/account_restrict_journal/models/account_move.py @@ -40,13 +40,9 @@ class AccountMove(models.Model): if rec.full_reconcile_id: payment = self.env['account.payment.register'].search( [('id', '=', rec.full_reconcile_id.id)]) - if payment.journal_id.id in self.env.user.journal_ids.ids and \ - self.env.user.has_group( - "account_restrict_journal.user_allowed_journal"): + if payment.journal_id.id in self.env.user.journal_ids.ids: raise ValidationError(_('Restricted journals found.')) - if self.journal_id.id in self.env.user.journal_ids.ids and \ - self.env.user.has_group( - "account_restrict_journal.user_allowed_journal"): + if self.journal_id.id in self.env.user.journal_ids.ids: raise ValidationError(_('Restricted journals found.')) @api.onchange('partner_id') diff --git a/account_restrict_journal/models/account_payment_register.py b/account_restrict_journal/models/account_payment_register.py index 9d722e92f..9aad72e73 100644 --- a/account_restrict_journal/models/account_payment_register.py +++ b/account_restrict_journal/models/account_payment_register.py @@ -35,8 +35,8 @@ class AccountPaymentRegister(models.TransientModel): for wizard in self: if wizard.can_edit_wizard: batch = wizard._get_batches()[0] - wizard.available_journal_ids = \ - wizard._get_batch_available_journals(batch) + wizard.available_journal_ids = wizard._get_batch_available_journals( + batch) else: wizard.available_journal_ids = self.env[ 'account.journal'].search( diff --git a/account_restrict_journal/models/res_users.py b/account_restrict_journal/models/res_users.py index 4bffae55e..a53a62b63 100644 --- a/account_restrict_journal/models/res_users.py +++ b/account_restrict_journal/models/res_users.py @@ -19,8 +19,7 @@ # If not, see . # ############################################################################# -from odoo import fields, models, _ -from odoo.exceptions import ValidationError +from odoo import fields, models class ResUsers(models.Model): @@ -31,33 +30,11 @@ class ResUsers(models.Model): check_user = fields.Boolean(string="Check", compute='_compute_check_user', help="Check the field is true or false") journal_ids = fields.Many2many( - 'account.journal', + 'account.journal', 'account_restrict_journal_journal_ids_rel', string='Restricted Journals', help='Only the selected journal will be visible' ' to the particular user') - def write(self, vals): - """ - Override the write method to restrict users with specific groups. - :param vals: Dictionary of field values to update. - :type vals: dict - :raises: ValidationError if the current user has both - 'account_restrict_journal.user_allowed_journal' - and 'base.group_system' groups and attempts to restrict - journals of the Administrator. - :return: None - """ - super().write(vals) - if self.env.user.has_group( - 'account_restrict_journal.user_allowed_journal') and \ - self.env.user.has_group('base.group_system'): - user_groups = self.env.user.groups_id.filtered( - lambda g: g.name == 'Restrict Journals') - if user_groups: - raise ValidationError( - _("You are not allowed to restrict journals for the " - "Administrator.")) - def _compute_check_user(self): """Function for viewing the page for restrict journal users.""" self.check_user = False diff --git a/account_restrict_journal/security/ir_rule.xml b/account_restrict_journal/security/ir_rule.xml index ff9c107c3..23f97f1ff 100644 --- a/account_restrict_journal/security/ir_rule.xml +++ b/account_restrict_journal/security/ir_rule.xml @@ -1,6 +1,6 @@ - + Account Journal Restrict on Users @@ -15,7 +15,6 @@ - Account Payment Restrict on Users