diff --git a/account_payment_order/models/account_move_line.py b/account_payment_order/models/account_move_line.py index 806745d9f..2d90c29d0 100644 --- a/account_payment_order/models/account_move_line.py +++ b/account_payment_order/models/account_move_line.py @@ -48,9 +48,10 @@ class AccountMoveLine(models.Model): else: ml.partner_bank_id = ml.partner_bank_id - def _prepare_payment_line_vals(self, payment_order): - self.ensure_one() - assert payment_order, "Missing payment order" + def _get_communication(self): + """ + Retrieve the communication string for the payment order + """ aplo = self.env["account.payment.line"] # default values for communication_type and communication communication_type = "normal" @@ -70,6 +71,12 @@ class AccountMoveLine(models.Model): elif "out" in self.move_id.move_type: # Force to only put invoice number here communication = self.move_id.name + return communication_type, communication + + def _prepare_payment_line_vals(self, payment_order): + self.ensure_one() + assert payment_order, "Missing payment order" + communication_type, communication = self._get_communication() if self.currency_id: currency_id = self.currency_id.id amount_currency = self.amount_residual_currency