跳至内容
菜单
此问题已终结
3 回复
3914 查看

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


形象
丢弃
最佳答案

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

形象
丢弃
编写者 最佳答案
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

形象
丢弃
最佳答案

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 "طلب البيع:"


形象
丢弃
编写者

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?

相关帖文 回复 查看 活动
2
6月 25
1147
3
7月 25
1507
1
6月 25
1485
2
5月 25
1462
1
5月 25
776