diff --git a/account_advanced_protection_features/i18n/fr.po b/account_advanced_protection_features/i18n/fr.po index 0def132..bcf1711 100644 --- a/account_advanced_protection_features/i18n/fr.po +++ b/account_advanced_protection_features/i18n/fr.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-26 13:13+0000\n" -"PO-Revision-Date: 2024-03-26 13:13+0000\n" +"POT-Creation-Date: 2025-08-21 16:39+0000\n" +"PO-Revision-Date: 2025-08-21 16:39+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -15,35 +15,54 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" -#. module: account_move_protect_deleting -#. odoo-python -#: code:addons/account_move_protect_deleting/models/account_move.py:0 -#, python-format -msgid "You cannot delete this account move because it has been posted." -msgstr "Vous ne pouvez pas supprimer cette pièce comptable car elle à déjà été confirmée." +#. module: account_advanced_protection_features +#: model:ir.model,name:account_advanced_protection_features.model_account_journal +msgid "Journal" +msgstr "" - -#. module: account_move_protect_reset_to_draft -#: model:ir.model,name:account_move_protect_reset_to_draft.model_account_invoice_send -msgid "Account Invoice Send" -msgstr "Facture du compte envoyée" - -#. module: account_move_protect_reset_to_draft -#: model:ir.model,name:account_move_protect_reset_to_draft.model_account_move +#. module: account_advanced_protection_features +#: model:ir.model,name:account_advanced_protection_features.model_account_move msgid "Journal Entry" msgstr "Pièce comptable" -#. module: account_move_protect_reset_to_draft -#: model:ir.model.fields,field_description:account_move_protect_reset_to_draft.field_account_bank_statement_line__sent_by_email -#: model:ir.model.fields,field_description:account_move_protect_reset_to_draft.field_account_move__sent_by_email -#: model:ir.model.fields,field_description:account_move_protect_reset_to_draft.field_account_payment__sent_by_email -msgid "Sent By Email" -msgstr "Envoyé par email" +#. module: account_advanced_protection_features +#: model:ir.model.fields,field_description:account_advanced_protection_features.field_account_journal__prevent_deletion_of_posted_account_move +msgid "Prevent to delete an already posted account move" +msgstr "Empêcher la suppression des pièces comptables déjà confirmées" -#. module: account_move_protect_reset_to_draft +#. module: account_advanced_protection_features +#: model:ir.model.fields,field_description:account_advanced_protection_features.field_account_journal__prevent_reset_to_draft_sent_invoice +msgid "Prevent to reset to draft a sent invoice" +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 +#: 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 +msgid "Smart Search" +msgstr "" + +#. module: account_advanced_protection_features #. odoo-python -#: code:addons/account_move_protect_reset_to_draft/models/account_move.py:0 +#: code:addons/account_advanced_protection_features/models/account_move.py:0 +#, python-format +msgid "You cannot delete this account move because it has been posted." +msgstr "" +"Vous ne pouvez pas supprimer cette pièce comptable car elle à déjà été " +"confirmée." + +#. module: account_advanced_protection_features +#. odoo-python +#: code:addons/account_advanced_protection_features/models/account_move.py:0 #, python-format msgid "" "You cannot reset to draft this invoice because it has been sent by email." -msgstr "Vous ne pouvez pas remettre en brouillon cette facture parce qu'elle a déjà été envoyée par email au client." +msgstr "" +"Vous ne pouvez pas remettre en brouillon cette facture parce qu'elle a déjà " +"été envoyée par email au client." diff --git a/account_advanced_protection_features/models/account_journal.py b/account_advanced_protection_features/models/account_journal.py index 07dc21a..5bd793e 100644 --- a/account_advanced_protection_features/models/account_journal.py +++ b/account_advanced_protection_features/models/account_journal.py @@ -4,3 +4,4 @@ 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") diff --git a/account_advanced_protection_features/models/account_move.py b/account_advanced_protection_features/models/account_move.py index 9ce757d..7c8f09b 100644 --- a/account_advanced_protection_features/models/account_move.py +++ b/account_advanced_protection_features/models/account_move.py @@ -16,12 +16,14 @@ class AccountMove(models.Model): @api.ondelete(at_uninstall=False) def _check_posted(self): - """ Prevent deletion of a account move if it has been posted - exeptions : Check deposit or Cash deposit. In V16 in odoo the account move is deleted + """ Prevent deletion of an account move if it has been posted + exceptions : Check deposit or Cash deposit. In V16 in odoo the account move is deleted when the check deposit is reset to draft. This work the same with Cash deposit """ for rec in self: + if not rec.journal_id.prevent_deletion_of_posted_account_move: + continue is_cash_deposit = False is_check_deposit = False @@ -30,7 +32,7 @@ class AccountMove(models.Model): if rec.env.get('account.cash.deposit'): for cash_deposit in rec.env['account.cash.deposit'].search([]): if cash_deposit.move_id == rec: - print (cash_deposit.move_id, rec) + print(cash_deposit.move_id, rec) is_cash_deposit = True # # search in account.check.deposit if account move is this one diff --git a/account_advanced_protection_features/views/account_journal_views.xml b/account_advanced_protection_features/views/account_journal_views.xml index 2541acf..d5d1f67 100644 --- a/account_advanced_protection_features/views/account_journal_views.xml +++ b/account_advanced_protection_features/views/account_journal_views.xml @@ -6,6 +6,9 @@ +