New account advanced protection features module #23

Open
mondot wants to merge 8 commits from new_account_advanced_protection_features into 16.0
4 changed files with 53 additions and 28 deletions
Showing only changes of commit a0ab4f96bd - Show all commits

View File

@@ -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."

View File

@@ -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")

View File

@@ -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
mondot commented 2025-09-15 10:27:49 +00:00 (Migrated from github.com)
Review
```suggestion ```
@@ -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

View File

@@ -6,6 +6,9 @@
<field name="inherit_id" ref="account.view_account_journal_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='restrict_mode_hash_table']" position="after">
<field
name="prevent_deletion_of_posted_account_move"
/>
<field
name="prevent_reset_to_draft_sent_invoice"
attrs="{'invisible': [('type', '!=', 'sale')]}"