You are required to file Schedule B-2 (Form 1065) Election Out of the Centralized Partnership Audit Regime if you answer "Yes" to question 25 on Schedule B within Form 1065 U.S. Return of Partnership Income, "Is the partnership electing out of the centralized partnership audit regime under section 6221(b)?".
Schedule B-2 (Form 1065) is not required for corporation returns.
Per IRS Instructions for Form 1065, U.S. Return of Partnership Income, on page 2:
Centralized Partnership Audit Regime
The Bipartisan Budget Act of 2015 (BBA) created a new centralized partnership audit regime effective for partnership tax years beginning after 2017. The new audit regime replaces the consolidated audit proceedings under TEFRA. The new audit regime applies to all partnerships unless the partnership is an eligible partnership and elects out by making a valid election using Schedule B-2 (Form 1065).
On page 26:
Answer "Yes" if an eligible partnership chooses to elect out of the centralized partnership audit regime for the tax year and enter the total from Schedule B-2, Part III, line 3. If making the election, attach a completed Schedule B-2 to Form 1065. A partnership is an eligible partnership for the tax year if it has 100 or fewer eligible partners in that year. Eligible partners are individuals, C corporations, S corporations, foreign entities that would be C corporations if they were domestic entities, and estates of deceased partners. The determination as to whether the partnership has 100 or fewer partners is made by adding the number of Schedules K-1 required to be issued by the partnership for the tax year to the number of Schedules K-1 required to be issued by any partner that is an S corporation to its shareholders for the tax year of the S corporation ending with or within the partnership tax year. A partnership isn't eligible to elect out of the centralized partnership audit regime if it is required to issue a Schedule K-1 to any of the following partners.
Note that any link in the information above is updated each year automatically and will take you to the most recent version of the document at the time it is accessed.