diff --git a/addons/account/models/account_payment.py b/addons/account/models/account_payment.py index 4f8dac824b9..6f634f342ac 100644 --- a/addons/account/models/account_payment.py +++ b/addons/account/models/account_payment.py @@ -404,13 +404,13 @@ class AccountPayment(models.Model): and payment.partner_id == payment.journal_id.company_id.partner_id \ and payment.destination_journal_id - @api.depends('payment_type', 'journal_id') + @api.depends('available_payment_method_line_ids') def _compute_payment_method_line_id(self): ''' Compute the 'payment_method_line_id' field. - This field is not computed in '_compute_payment_method_fields' because it's a stored editable one. + This field is not computed in '_compute_payment_method_line_fields' because it's a stored editable one. ''' for pay in self: - available_payment_method_lines = pay.journal_id._get_available_payment_method_lines(pay.payment_type) + available_payment_method_lines = pay.available_payment_method_line_ids # Select the first available one by default. if pay.payment_method_line_id in available_payment_method_lines: @@ -424,7 +424,7 @@ class AccountPayment(models.Model): def _compute_payment_method_line_fields(self): for pay in self: pay.available_payment_method_line_ids = pay.journal_id._get_available_payment_method_lines(pay.payment_type) - to_exclude = self._get_payment_method_codes_to_exclude() + to_exclude = pay._get_payment_method_codes_to_exclude() if to_exclude: pay.available_payment_method_line_ids = pay.available_payment_method_line_ids.filtered(lambda x: x.code not in to_exclude)