def METHOD_NAME(self, payments=None):
    if self.payment_type == "outbound":
        ref = _("Payment order %s") % self.name
    else:
        ref = _("Debit order %s") % self.name
    if payments and len(payments) == 1:
        ref += " - " + payments.name
    vals = {
        "date": payments[0].date,
        "journal_id": self.journal_id.id,
        "ref": ref,
        "grouped_payment_order_id": self.id,
        "line_ids": [],
    }
    total_company_currency = total_payment_currency = 0
    for pline in payments:
        amount_company_currency = abs(pline.move_id.line_ids[0].balance)
        total_company_currency += amount_company_currency
        total_payment_currency += pline.amount
        partner_ml_vals = self._prepare_move_line_partner_account(pline)
        vals["line_ids"].append((0, 0, partner_ml_vals))
    trf_ml_vals = self._prepare_move_line_offsetting_account(
        total_company_currency, total_payment_currency, payments
    )
    vals["line_ids"].append((0, 0, trf_ml_vals))
    return vals