New account advanced protection features module #23

Open
mondot wants to merge 8 commits from new_account_advanced_protection_features into 16.0
3 changed files with 58 additions and 13 deletions
Showing only changes of commit e437d7fdf2 - Show all commits

View File

@@ -6,8 +6,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 16.0\n" "Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-08-22 08:18+0000\n" "POT-Creation-Date: 2025-08-29 08:28+0000\n"
"PO-Revision-Date: 2025-08-22 08:18+0000\n" "PO-Revision-Date: 2025-08-29 08:28+0000\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@@ -16,13 +16,13 @@ msgstr ""
"Plural-Forms: \n" "Plural-Forms: \n"
#. module: account_advanced_protection_features #. module: account_advanced_protection_features
#: model:res.groups,name:account_advanced_protection_features.group_account_advanced_manager #: model:res.groups,name:account_advanced_protection_features.group_account_protection_manager
msgid "Access to account advanced protection features" msgid "Access to account advanced protection features"
msgstr "Accès aux fonctionnalités avancées de protection des journaux" msgstr "Accès aux fonctionnalités avancées de protection des journaux"
#. module: account_advanced_protection_features #. module: account_advanced_protection_features
#: model:ir.model.fields,field_description:account_advanced_protection_features.field_account_journal__allow_bank_statement_deletion #: model:ir.model.fields,field_description:account_advanced_protection_features.field_account_journal__allow_bank_statement_deletion
msgid "Allow bank statement deletion" msgid "Allow bank statements deletion"
msgstr "Autoriser la suppression de relevé bancaire" msgstr "Autoriser la suppression de relevé bancaire"
#. module: account_advanced_protection_features #. module: account_advanced_protection_features
@@ -30,6 +30,11 @@ msgstr "Autoriser la suppression de relevé bancaire"
msgid "Bank Statement" msgid "Bank Statement"
msgstr "Relevé bancaire" msgstr "Relevé bancaire"
#. module: account_advanced_protection_features
#: model:ir.model,name:account_advanced_protection_features.model_account_bank_statement_line
msgid "Bank Statement Line"
msgstr "Ligne de relevé de compte"
#. module: account_advanced_protection_features #. module: account_advanced_protection_features
#: model:ir.model,name:account_advanced_protection_features.model_account_journal #: model:ir.model,name:account_advanced_protection_features.model_account_journal
msgid "Journal" msgid "Journal"
@@ -50,20 +55,41 @@ msgstr "Empêcher la suppression des pièces comptables déjà confirmées"
msgid "Prevent to reset to draft a sent invoice" msgid "Prevent to reset to draft a sent invoice"
msgstr "Empêcher la remise en brouillon d'une facture envoyée" msgstr "Empêcher la remise en brouillon d'une facture envoyée"
#. module: account_advanced_protection_features
#: model:ir.model.fields,field_description:account_advanced_protection_features.field_account_bank_statement_line__sent_by_email
#: model:ir.model.fields,field_description:account_advanced_protection_features.field_account_move__sent_by_email
#: model:ir.model.fields,field_description:account_advanced_protection_features.field_account_payment__sent_by_email
msgid "Sent By Email"
msgstr "Envoyée par email"
#. module: account_advanced_protection_features #. module: account_advanced_protection_features
#: model:ir.model.fields,field_description:account_advanced_protection_features.field_account_bank_statement__smart_search #: model:ir.model.fields,field_description:account_advanced_protection_features.field_account_bank_statement__smart_search
#: model:ir.model.fields,field_description:account_advanced_protection_features.field_account_bank_statement_line__smart_search
#: model:ir.model.fields,field_description:account_advanced_protection_features.field_account_journal__smart_search #: model:ir.model.fields,field_description:account_advanced_protection_features.field_account_journal__smart_search
#: model:ir.model.fields,field_description:account_advanced_protection_features.field_account_move__smart_search #: model:ir.model.fields,field_description:account_advanced_protection_features.field_account_move__smart_search
msgid "Smart Search" msgid "Smart Search"
msgstr "" msgstr ""
#. module: account_advanced_protection_features
#. odoo-python
#: code:addons/account_advanced_protection_features/models/account_bank_statement.py:0
#, python-format
msgid ""
"The deletion of bank statement lines is not allowed for the journal %s."
msgstr ""
"La suppression des lignes de relevé bancaire n'est pas autorisée pour le journal %s."
#. module: account_advanced_protection_features
#. odoo-python
#: code:addons/account_advanced_protection_features/models/account_bank_statement.py:0
#, python-format
msgid "The deletion of bank statements is not allowed for the journal %s."
msgstr ""
"La suppression des relevés bancaires n'est pas autorisée pour le journal %s."
#. module: account_advanced_protection_features
#: model:ir.model.fields,help:account_advanced_protection_features.field_account_journal__allow_bank_statement_deletion
msgid ""
"Users with group Show Full Accounting Features (id: group_account_user) will"
" be allowed to delete account bank statements and bank statement lines."
msgstr ""
"Les utilisateurs avec le groupe 'Montrer les fonctions de comptabilité "
"complètes' seront autorisés à supprimer les relevés bancaires ainsi que les "
"lignes de relevés bancaires."
#. module: account_advanced_protection_features #. module: account_advanced_protection_features
#. odoo-python #. odoo-python
#: code:addons/account_advanced_protection_features/models/account_move.py:0 #: code:addons/account_advanced_protection_features/models/account_move.py:0

View File

@@ -8,6 +8,21 @@ class AccountBankStatement(models.Model):
for statement in self: for statement in self:
if not statement.journal_id.allow_bank_statement_deletion: if not statement.journal_id.allow_bank_statement_deletion:
raise UserError( raise UserError(
_(f"The deletion of bank statements is not allowed for the journal {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(AccountBankStatement, self).unlink()
class AccountBankStatementLine(models.Model):
_inherit = "account.bank.statement.line"
def unlink(self):
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
)
return super(AccountBankStatementLine, self).unlink()

View File

@@ -5,4 +5,8 @@ class AccountJournal(models.Model):
prevent_reset_to_draft_sent_invoice = fields.Boolean("Prevent to reset to draft a sent invoice") 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_deletion_of_posted_account_move = fields.Boolean("Prevent to delete an already posted account move")
allow_bank_statement_deletion = fields.Boolean("Allow bank statement deletion") 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."
)