From ca9135e36131a41a49f3b30a3b673bf639fedcf2 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Tue, 13 Feb 2024 13:31:19 +0100 Subject: [PATCH] [IMP] account_payment_order: No error on unknown payment method codes Since v14, the tool for changing the target transfer account is to create new payment methods, and put a method line in the journal with such account. Thus, there will be "fake" payment methods with no export handler with the only goal of having a different target account. Raising an error on such methods when finishing the payment order, forcing to add custom code for returning (False, False), is too much, so better to simply return that by default and don't block in these cases. TT47723 --- .../models/account_payment_order.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/account_payment_order/models/account_payment_order.py b/account_payment_order/models/account_payment_order.py index 76330fa92..331954c71 100644 --- a/account_payment_order/models/account_payment_order.py +++ b/account_payment_order/models/account_payment_order.py @@ -376,17 +376,13 @@ class AccountPaymentOrder(models.Model): return True def generate_payment_file(self): - """Returns (payment file as string, filename)""" + """Returns (payment file as string, filename). + + By default, any method not specifically intercepted by extra modules will do + nothing, including the existing manual one. + """ self.ensure_one() - if self.payment_method_id.code == "manual": - return (False, False) - else: - raise UserError( - _( - "No handler for this payment method. Maybe you haven't " - "installed the related Odoo module." - ) - ) + return (False, False) def open2generated(self): self.ensure_one()