Ir al contenido
Menú
Se marcó esta pregunta
3 Respuestas
4044 Vistas

currently i am converting my module from odoo 15 to odoo 17, so in one of my module i am using ir.translation model for my use, but the model is not present in odoo 17, is it because odoo removed this model or used in other way. please help


class IrTrans(models.Model):
_inherit = "ir.translation"

def write(self, vals):
res = super(IrTrans, self).write(vals)
for rec in self:
product = self.env['product.template'].search([('id', '=', rec.res_id)])
a = vals.get('value')
product.description_sale = a
return res

this is how i used in odoo 15 , how can i achieve this on odoo 17


Avatar
Descartar
Mejor respuesta

ir.translation is no longer exist since odoo 16.0, it has been replace with jsonb field, mean that translation field is now store in database as jsonb column , check PR : https://github.com/odoo/odoo/pull/97692

So describe your method 's purpose and some example maybe

Avatar
Descartar
Autor Mejor respuesta
class IrTrans(models.Model):
_inherit = "ir.translation"

def write(self, vals):
res = super(IrTrans, self).write(vals)
for rec in self:
product = self.env['product.template'].search([('id', '=', rec.res_id)])
a = vals.get('value')
product.description_sale = a
return res

this is the function i used in odoo 15, can i achieve this on odoo 17

Avatar
Descartar
Mejor respuesta

you can use .po files to update translations.

Here is an example:

# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * your module name
#
# Translator:
# Adil Akbar, 2024
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo\n"
"POT-Creation-Date: 2024-05-23 12:00+0000\n"
"PO-Revision-Date: 2024-05-23 12:00+0000\n"
"Language: ar\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"


#. module: your_module_name
#: model_terms:ir.ui.view,arch_db:your_module_name.view
msgid "Sale Order:"
msgstr "طلب البيع:"


Avatar
Descartar
Autor

class IrTrans(models.Model):
_inherit = "ir.translation"

def write(self, vals):
res = super(IrTrans, self).write(vals)
for rec in self:
product = self.env['product.template'].search([('id', '=', rec.res_id)])
a = vals.get('value')
product.description_sale = a
return res
this is the function i used in odoo 15, can i achieve this on odoo 17?

Publicaciones relacionadas Respuestas Vistas Actividad
2
jun 25
1230
3
jul 25
1868
1
jun 25
2031
2
may 25
1862
1
may 25
1131