from odoo.http import route
from odoo.addons.sale.controllers.portal import CustomerPortal


class CustomerPortalExternalTax(CustomerPortal):
    @route()
    def portal_order_page(self, *args, **kwargs):
        response = super().portal_order_page(*args, **kwargs)
        if 'sale_order' not in response.qcontext:
            return response


        so = response.qcontext['sale_order']
        so.with_company(so.company_id)._get_and_set_external_taxes_on_eligible_records()

        return response
