diff options
| author | Nicolas Martinelli <nim@odoo.com> | 2020-07-29 06:40:58 +0000 |
|---|---|---|
| committer | Nicolas Martinelli <nim@odoo.com> | 2020-07-30 08:49:10 +0000 |
| commit | dcf1f48ee6729780d1d8a4fb88bf23138744ae76 (patch) | |
| tree | 63ecb97a9713305943bebdf1b0df803aec42a87b /addons/account/models/account_bank_statement.py | |
| parent | 8b7861ddabf92f85aff7665cb5bd79922676f545 (diff) | |
[FIX] account: prevent unlink item linked to posted entry
- Create a vendor bill, post it
- Go to Accounting > Accounting > Journals > Purchases
- Select the items linked to the vendor bill, delete
Nothing prevents from deleting the items while a posted entry cannot be
modified.
opw-2305873
closes odoo/odoo#55187
X-original-commit: 14ef02f73e649b5f8c50f09213f0a0dbddf46217
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Diffstat (limited to 'addons/account/models/account_bank_statement.py')
| -rw-r--r-- | addons/account/models/account_bank_statement.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py index f500d32886b..dc45bbbd247 100644 --- a/addons/account/models/account_bank_statement.py +++ b/addons/account/models/account_bank_statement.py @@ -1187,7 +1187,7 @@ class AccountBankStatementLine(models.Model): to_delete_commands = [(2, line.id) for line in suspense_lines + other_lines] # Cleanup previous lines. - self.move_id.with_context(check_move_validity=False, skip_account_move_synchronization=True).write({ + self.move_id.with_context(check_move_validity=False, skip_account_move_synchronization=True, force_delete=True).write({ 'line_ids': to_delete_commands + to_create_commands, 'to_check': to_check, }) @@ -1232,7 +1232,7 @@ class AccountBankStatementLine(models.Model): self.payment_ids.unlink() for st_line in self: - st_line.write({ + st_line.with_context(force_delete=True).write({ 'to_check': False, 'line_ids': [(5, 0)] + [(0, 0, line_vals) for line_vals in st_line._prepare_move_line_default_vals()], }) |
