Skip to Content
Menu
This question has been flagged
3 Replies
3834 Zobrazenia

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
Zrušiť
Best Answer

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
Zrušiť
Autor Best Answer
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
Zrušiť
Best Answer

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
Zrušiť
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?

Related Posts Replies Zobrazenia Aktivita
2
jún 25
1112
3
júl 25
1430
1
jún 25
1368
2
máj 25
1396
1
máj 25
736