odoo/odoo · error · Exception

No file sent.

Error message

No file sent.

What it means

A plain Exception (not UserError) raised by _import_zipfile when the module_file argument is falsy — i.e. the caller invoked the import API without attaching a file. Because it is a bare Exception, it typically surfaces as a traceback rather than a friendly UI message; it almost always indicates a caller bug or an empty upload.

Source

Thrown at addons/base_import_module/models/ir_module.py:329

        ):
            body = self.env['ir.qweb']._render(f"{module}.welcome_article_body", lang=self.env.user.lang)
            article_record.write({'body': body})

        mod._update_from_terp(terp)
        _logger.info("Successfully imported module '%s'", module)

        if force_website_id:
            # Restore neutralized website_id.
            request.session['force_website_id'] = force_website_id

        return True

    @api.model
    def _import_zipfile(self, module_file, force=False, with_demo=False):
        if not self.env.is_admin():
            raise AccessError(_("Only administrators can install data modules."))
        if not module_file:
            raise Exception(_("No file sent."))
        if not zipfile.is_zipfile(module_file):
            raise UserError(_('Only zip files are supported.'))

        module_names = []
        with zipfile.ZipFile(module_file, "r") as z:
            for zf in z.infolist():
                if zf.file_size > MAX_FILE_SIZE:
                    raise UserError(_("File '%s' exceed maximum allowed file size", zf.filename))

            with file_open_temporary_directory(self.env) as module_dir:
                manifest_files = sorted(
                    (file.filename.split('/')[0], file)
                    for file in z.infolist()
                    if file.filename.count('/') == 1
                    and file.filename.split('/')[1] in MANIFEST_NAMES
                )
                module_data_files = defaultdict(list)
                dependencies = defaultdict(list)

View on GitHub (pinned to 1e661df964)

Solutions

  1. Attach a valid ZIP file before calling the import (validate the upload client-side)
  2. Check the field name mapping between your form/RPC payload and module_file
  3. Guard the call: if not module_file: skip or show a validation message instead of invoking the API

Example fix

# before
env['base.import.module']._import_zipfile(module_file=None)  # Exception('No file sent.')

# after
if not module_file:
    raise UserError(_('Please select a module file to import.'))
env['base.import.module']._import_zipfile(module_file=module_file)
Defensive patterns

Strategy: validation

Validate before calling

if not module_file or not getattr(module_file, 'read', lambda: b'')():
    raise UserError(_('Please attach a module file.'))
env['base.import.module']._import_zipfile(module_file=module_file)

Prevention

When it happens

Trigger: Calling _import_zipfile(module_file=None) / submitting the import wizard with no file selected, or an RPC payload where the 'file' key is missing or empty.

Common situations: Front-end form submitted before a file was chosen; HTTP file field name mismatch (server reads 'module_file' but form posts 'file'); base64 field left empty on base.import.module record.

Related errors


AI-assisted analysis of odoo/odoo@1e661df964 (2026-08-15). Data as JSON: /api/errors/6c90ca83723eb889. Report an issue: GitHub.