diff --git a/account_loan/models/account_loan_line.py b/account_loan/models/account_loan_line.py index 6946a52b544..abb8d99a661 100644 --- a/account_loan/models/account_loan_line.py +++ b/account_loan/models/account_loan_line.py @@ -387,6 +387,12 @@ def _invoice_line_vals(self): vals = self._add_interests_values_invoice_line(vals) return vals + def _auto_post_moves(self): + """ + Inhertiance hook to conditon posting of moves + """ + return True + def _generate_move(self, journal=False, account=False): """ Computes and post the moves of loans @@ -402,7 +408,8 @@ def _generate_move(self, journal=False, account=False): move = self.env["account.move"].create( record._move_vals(journal=journal, account=account) ) - move.action_post() + if record._auto_post_moves(): + move.action_post() res.append(move.id) return res