Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
351 Vistas

I did a commit to a staging branch in Odoo SH with Odoo version 18, and I'm getting this warning in translation. does anyone know what I'm doing wrong?


Warning:

_logger.log(log_level, 'no translation language detected, skipping translation %s', frame, stack_info=True)

Python code:

from odoo import models, fields, api, _
from odoo.exceptions import ValidationError


class InvoiceServiceTypeDetail(models.Model):
    _name = 'invoice.service.type.detail'
    _description = "Invoice Service Type Detail"

    name = fields.Char()
    code = fields.Char(size=2)
    parent_code = fields.Char()

    @api.constrains('code')
    def _check_unique_code(self):
        for rec in self:
            if rec.code:
                existing = self.env['invoice.service.type.detail'].search_count(
                    [('code', '=', rec.code), ('id', '!=', rec.id)]
                )
                if existing:
                    raise ValidationError(_("Code must be unique"))

es_DO.po:

#. module: dgii_reports
#: model:ir.model.constraint,message:dgii_reports.constraint_invoice_service_type_detail_code_unique
msgid "Code must be unique"
msgstr "El código debe ser único"
Avatar
Descartar
Mejor respuesta

Hi,


Please check this.


The warning doesn’t mean your ValidationError(_("Code must be unique"))is wrong — it just means Odoo can’t figure out what language to apply the translation to because of either:


    Missing/incorrect Language: header in .po file, or


    Language not installed in your DB.


How to fix it


    Check the .po file header — the top of your es_DO.po file should look like this:


    msgid ""

    msgstr ""

    "Project-Id-Version: Odoo Server 18.0\n"

    "POT-Creation-Date: 2025-08-12 00:00+0000\n"

    "PO-Revision-Date: 2025-08-12 00:00+0000\n"

    "Last-Translator: Your Name <you@example.com>\n"

    "Language-Team: \n"

    "Language: es_DO\n"

    "MIME-Version: 1.0\n"

    "Content-Type: text/plain; charset=UTF-8\n"

    "Content-Transfer-Encoding: 8bit\n"


    The Language: es_DO line is what Odoo uses to detect the language.


    Ensure the language is installed in your Odoo database:


        Go to Settings → Translations → Languages.


        Check if it es_DO is there; if not, create it or load it.


    Make sure the .po file name matches the language code exactly:


    es_DO.po   is the correct one.


    Update translations after fixing:


    From the Odoo UI: Settings → Translations → Import Translation.


Hope it helps.

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
3
mar 19
3859
0
nov 16
318
2
jul 22
8255
4
jul 24
6663
2
jul 24
2681