Impacted versions:
Master branch, should by 12.0

Steps to reproduce:
Install a third party addon with localization po file in i18n folder, even loading translation manually, the translation won't work, The console reports error: Translation .... not found in reference pot, skipping.
Reverse the change of  "odoo/tools/translate.py" in this commit, the issue was gone.

Expected behavior:
The po translation works as before.



odoo/tools/translate.py
fileobj.seek(0)
        if fileformat == 'csv':
            reader = pycompat.csv_reader(fileobj, quotechar='"', delimiter=',')
            
            fields = next(reader)
        elif fileformat == 'po':
            reader = PoFile(fileobj)
            fields = ['type', 'name', 'res_id', 'src', 'value', 'comments']
            
            
            
            if isinstance(fileobj.name, str) and fileobj.name.endswith('.po'):
                try:
                    
                    
                    
                    
                    addons_module_i18n, _ignored = os.path.split(fileobj.name)
                    addons_module, i18n_dir = os.path.split(addons_module_i18n)
                    addons, module = os.path.split(addons_module)
                    pot_handle = file_open(os.path.join(
                        addons, module, i18n_dir, module + '.pot'), mode='rb')
                    pot_reader = PoFile(pot_handle)
                except:
                    pass
        else:
            _logger.info('Bad file format: %s', fileformat)
            raise Exception(_('Bad file format: %s') % fileformat)
        
        class Target(object):