[FIX]account_move_protect_deleting:check if account.cash.deposit and account.check.deposit models exists

This commit is contained in:
2025-02-20 14:43:19 +01:00
parent e24843bf18
commit 6b591cc5fc
2 changed files with 16 additions and 10 deletions

View File

@@ -3,7 +3,7 @@
{ {
"name": "account_move_protect_deleting", "name": "account_move_protect_deleting",
"version": "16.0.1.0.1", "version": "16.0.1.0.2",
"author": "Elabore", "author": "Elabore",
"website": "https://elabore.coop", "website": "https://elabore.coop",
"maintainer": "Boris Gallet", "maintainer": "Boris Gallet",

View File

@@ -12,16 +12,22 @@ class AccountMove(models.Model):
This work the same with Cash deposit This work the same with Cash deposit
""" """
for rec in self: for rec in self:
# search in account.cash.deposit if account move is this one
for cash_deposit in rec.env['account.cash.deposit'].search([]):
if 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 is_cash_deposit = False
for check_deposit in rec.env['account.check.deposit'].search([]): is_check_deposit = False
if check_deposit.move_id == rec:
is_check_deposit = True # search in account.cash.deposit if account move is this one
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)
is_cash_deposit = True
# # search in account.check.deposit if account move is this one
if rec.env.get('account.check.deposit'):
for check_deposit in rec.env['account.check.deposit'].search([]):
if check_deposit.move_id == rec:
is_check_deposit = True
if ( if (
rec.posted_before and rec.posted_before and