Skip to content

Commit b74dba3

Browse files
committed
[FIX] account: cancel deferred entries protected by audit trail when reversed
Steps to reproduce: - Install accountant - In Accounting settings, activate "Audit Trail" - Create an invoice: * Customer: [any] * Invoice Lines: - Product: [any] - Start Date: [2 months ago] - End Date: [2 months later] - Confirm the invoice => Deferred Entries are created. Posted for the previous months and in draft for the future ones. - Reset the invoice to draft Issue: The draft entires are correctly unlinked, but the posted ones are reversed instead of being cancelled. Cause: This fix odoo@cc448bf is supposed to cancel the deferred entries when the move is protected by the audi trail. However we never get into the `elif move._is_protected_by_audit_trail():` branch because its condition is also included in the previous `if not move._can_be_unlinked():` branch. opw-4891975 closes odoo#216628 Related: odoo/enterprise#88992 Signed-off-by: Ruben Gomes (rugo) <[email protected]>
1 parent c52f12d commit b74dba3

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

addons/account/models/account_move.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4801,8 +4801,7 @@ def _reverse_moves(self, default_values_list=None, cancel=False):
48014801
def _can_be_unlinked(self):
48024802
self.ensure_one()
48034803
lock_date = self.company_id._get_user_fiscal_lock_date(self.journal_id)
4804-
is_part_of_audit_trail = self.posted_before and self.company_id.check_account_audit_trail
4805-
return not self.inalterable_hash and self.date > lock_date and not is_part_of_audit_trail
4804+
return not self.inalterable_hash and self.date > lock_date
48064805

48074806
def _is_protected_by_audit_trail(self):
48084807
return any(move.posted_before and move.company_id.check_account_audit_trail for move in self)

0 commit comments

Comments
 (0)