diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 3387143..9abafc6 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -49,12 +49,9 @@ repos:
$(git rev-parse --show-toplevel))"'
- id: oca-gen-addon-readme
entry:
- bash -c 'oca-gen-addon-readme
- --addons-dir=.
- --branch=$(git symbolic-ref
+ bash -c 'oca-gen-addon-readme --addons-dir=. --branch=$(git symbolic-ref
refs/remotes/origin/HEAD | sed "s@^refs/remotes/origin/@@")
- --repo-name=$(basename $(git rev-parse --show-toplevel))
- --org-name="Elabore"
+ --repo-name=$(basename $(git rev-parse --show-toplevel)) --org-name="Elabore"
--if-source-changed --keep-source-digest'
- repo: https://github.com/OCA/odoo-pre-commit-hooks
diff --git a/account_advanced_protection_features/.gitignore b/account_advanced_protection_features/.gitignore
index df8a896..6da5887 100644
--- a/account_advanced_protection_features/.gitignore
+++ b/account_advanced_protection_features/.gitignore
@@ -1,2 +1,2 @@
*.*~
-*pyc
\ No newline at end of file
+*pyc
diff --git a/account_advanced_protection_features/__manifest__.py b/account_advanced_protection_features/__manifest__.py
index ac5740f..ad24bf3 100644
--- a/account_advanced_protection_features/__manifest__.py
+++ b/account_advanced_protection_features/__manifest__.py
@@ -3,27 +3,21 @@
{
"name": "account_advanced_protection_features",
- "version": "16.0.1.0.0",
+ "version": "18.0.1.0.0",
"author": "Elabore",
- "website": "https://elabore.coop",
+ "website": "https://git.elabore.coop/elabore/account-tools",
"maintainer": "Quentin Mondot",
"license": "AGPL-3",
"category": "Tools",
"summary": "Add several protection features about accounting",
# any module necessary for this one to work correctly
- "depends": [
- "base",
- "account"
- ],
+ "depends": ["base", "account"],
"qweb": [],
"external_dependencies": {
"python": [],
},
# always loaded
- "data": [
- "security/res_groups.xml",
- "views/account_journal_views.xml"
- ],
+ "data": ["security/res_groups.xml", "views/account_journal_views.xml"],
# only loaded in demonstration mode
"demo": [],
"js": [],
diff --git a/account_advanced_protection_features/i18n/fr.po b/account_advanced_protection_features/i18n/fr.po
index 67d8167..fb21d41 100644
--- a/account_advanced_protection_features/i18n/fr.po
+++ b/account_advanced_protection_features/i18n/fr.po
@@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 16.0\n"
+"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-08-29 08:28+0000\n"
"PO-Revision-Date: 2025-08-29 08:28+0000\n"
diff --git a/account_advanced_protection_features/models/account_bank_statement.py b/account_advanced_protection_features/models/account_bank_statement.py
index 79093b3..d14785e 100644
--- a/account_advanced_protection_features/models/account_bank_statement.py
+++ b/account_advanced_protection_features/models/account_bank_statement.py
@@ -1,6 +1,7 @@
-from odoo import models, _
+from odoo import _, models
from odoo.exceptions import UserError
+
class AccountBankStatement(models.Model):
_inherit = "account.bank.statement"
@@ -8,12 +9,16 @@ class AccountBankStatement(models.Model):
for statement in self:
if not statement.journal_id.allow_bank_statement_deletion:
raise UserError(
- _("The deletion of bank statements is not allowed for the journal %s.") % statement.journal_id.display_name
+ _(
+ "The deletion of bank statements is "
+ "not allowed for the journal %s."
+ )
+ % statement.journal_id.display_name
)
# we delete all the statement lines before deleting the statement itself
for line in statement.line_ids:
line.unlink()
- return super(AccountBankStatement, self).unlink()
+ return super().unlink()
class AccountBankStatementLine(models.Model):
@@ -23,6 +28,10 @@ class AccountBankStatementLine(models.Model):
for line in self:
if not line.journal_id.allow_bank_statement_deletion:
raise UserError(
- _("The deletion of bank statement lines is not allowed for the journal %s.") % line.journal_id.display_name
+ _(
+ "The deletion of bank statement lines is "
+ "not allowed for the journal %s."
+ )
+ % line.journal_id.display_name
)
- return super(AccountBankStatementLine, self).unlink()
+ return super().unlink()
diff --git a/account_advanced_protection_features/models/account_journal.py b/account_advanced_protection_features/models/account_journal.py
index 94755d2..09c0aaf 100644
--- a/account_advanced_protection_features/models/account_journal.py
+++ b/account_advanced_protection_features/models/account_journal.py
@@ -1,12 +1,18 @@
-from odoo import models, fields
+from odoo import fields, models
+
class AccountJournal(models.Model):
_inherit = "account.journal"
- prevent_reset_to_draft_sent_invoice = fields.Boolean("Prevent to reset to draft a sent invoice")
- prevent_deletion_of_posted_account_move = fields.Boolean("Prevent to delete an already posted account move")
+ prevent_reset_to_draft_sent_invoice = fields.Boolean(
+ "Prevent to reset to draft a sent invoice"
+ )
+ prevent_deletion_of_posted_account_move = fields.Boolean(
+ "Prevent to delete an already posted account move"
+ )
allow_bank_statement_deletion = fields.Boolean(
"Allow bank statements deletion",
- help="Users with group Show Full Accounting Features (id: group_account_user) will be allowed to delete account bank statements "
- "and bank statement lines."
+ help="Users with group Show Full Accounting Features (id: group_account_user) "
+ "will be allowed to delete account bank statements "
+ "and bank statement lines.",
)
diff --git a/account_advanced_protection_features/models/account_move.py b/account_advanced_protection_features/models/account_move.py
index ebb091d..3eee506 100644
--- a/account_advanced_protection_features/models/account_move.py
+++ b/account_advanced_protection_features/models/account_move.py
@@ -1,23 +1,34 @@
-from odoo import models, api, fields, _
+from odoo import _, api, models
from odoo.exceptions import UserError
+
class AccountMove(models.Model):
- _inherit = 'account.move'
+ _inherit = "account.move"
def button_draft(self):
if self.is_move_sent and self.journal_id.prevent_reset_to_draft_sent_invoice:
- raise UserError(_(
- "You cannot reset to draft this invoice because it has been sent by email."
- ))
- return super(AccountMove, self).button_draft()
+ raise UserError(
+ _(
+ "You cannot reset to draft this invoice because it "
+ "has been sent by email."
+ )
+ )
+ return super().button_draft()
@api.ondelete(at_uninstall=False)
def _check_posted(self):
- """ Prevent deletion of an account move if it has already been posted and
- journal parameter prevent_deletion_of_posted_account_move is activated
+ """
+ Prevent deletion of an account move if it has already been posted and journal
+ parameter prevent_deletion_of_posted_account_move is activated.
"""
for rec in self:
- if rec.posted_before and rec.journal_id.prevent_deletion_of_posted_account_move:
- raise UserError(_(
- "You cannot delete this account move because it has already been posted."
- ))
+ if (
+ rec.posted_before
+ and rec.journal_id.prevent_deletion_of_posted_account_move
+ ):
+ raise UserError(
+ _(
+ "You cannot delete this account move because it "
+ "has already been posted."
+ )
+ )
diff --git a/account_advanced_protection_features/security/res_groups.xml b/account_advanced_protection_features/security/res_groups.xml
index 542f970..e8fa3bd 100644
--- a/account_advanced_protection_features/security/res_groups.xml
+++ b/account_advanced_protection_features/security/res_groups.xml
@@ -1,7 +1,7 @@
-
+
Access to account advanced protection features
-
+
diff --git a/account_advanced_protection_features/views/account_journal_views.xml b/account_advanced_protection_features/views/account_journal_views.xml
index 4e3b367..9b17b2c 100644
--- a/account_advanced_protection_features/views/account_journal_views.xml
+++ b/account_advanced_protection_features/views/account_journal_views.xml
@@ -1,24 +1,27 @@
-
+
-
+
account.journal.form
account.journal
-
+