İçereği Atla
Menü
Bu soru işaretlendi
3 Cevaplar
3894 Görünümler

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
Vazgeç
En İyi Yanıt

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
Vazgeç
Üretici En İyi Yanıt
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
Vazgeç
En İyi Yanıt

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
Vazgeç
Üretici

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?

İlgili Gönderiler Cevaplar Görünümler Aktivite
2
Haz 25
1143
3
Tem 25
1497
1
Haz 25
1465
2
May 25
1455
1
May 25
770