Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
570 Lượt xem

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"
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 3 19
3969
0
thg 11 16
318
2
thg 7 22
8443
4
thg 7 24
6875
2
thg 7 24
4243