def METHOD_NAME(self):
    self.contract.write({"partner_id": self.partner.id})
    self.contract.on_change_partner_id()
    self.assertEqual(
        self.contract.payment_mode_id,
        self.contract.partner_id.customer_payment_mode_id,
    )
    self.contract.write(
        {
            "line_recurrence": True,
            "contract_type": "sale",
            "recurring_interval": 1,
            "recurring_rule_type": "monthly",
            "date_start": "2018-01-15",
            "contract_line_ids": [
                (
                    0,
                    0,
                    {
                        "product_id": self.product.id,
                        "name": "Database Administration 25",
                        "quantity": 2.0,
                        "uom_id": self.product.uom_id.id,
                        "price_unit": 200.0,
                    },
                )
            ],
        }
    )
    self.contract.recurring_create_invoice()
    new_invoice = self.contract._get_related_invoices()
    self.assertTrue(new_invoice)
    self.assertEqual(new_invoice.partner_id, self.contract.partner_id)
    self.assertEqual(new_invoice.payment_mode_id, self.contract.payment_mode_id)
    self.assertEqual(len(new_invoice.ids), 1)
    self.contract.recurring_create_invoice()
    self.assertEqual(self.contract.payment_mode_id, new_invoice.payment_mode_id)