Skip to Content
Menu
This question has been flagged
3 Replies
2852 Views

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
Discard
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
Discard
Author 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
Discard
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
Discard
Author

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 Views Activity
1
Jul 24
466
1
Feb 25
37
1
Feb 25
471
1
Jan 25
481
2
Dec 24
674