update common add core

This commit is contained in:
ivan deng
2020-09-12 00:50:06 +08:00
parent f459df89e8
commit 05cd3ec558
4 changed files with 39 additions and 1 deletions

View File

@@ -23,7 +23,7 @@
{ {
'name': 'odoo 14,13 Customize OEM(Boost, Data reset)', 'name': 'odoo 14,13 Customize OEM(Boost, Data reset)',
'version': '13.20.09.09', 'version': '13.20.09.10',
'author': 'Sunpop.cn', 'author': 'Sunpop.cn',
'category': 'Productivity', 'category': 'Productivity',
'website': 'https://www.sunpop.cn', 'website': 'https://www.sunpop.cn',
@@ -76,6 +76,7 @@
33. Add Demo Ribbon Setting. 33. Add Demo Ribbon Setting.
34. Add Remove all quality data. 34. Add Remove all quality data.
35. Fixed for odoo 14. 35. Fixed for odoo 14.
36. Add refresh translate for multi module.
This module can help to white label the Odoo. This module can help to white label the Odoo.
Also helpful for training and support for your odoo end-user. Also helpful for training and support for your odoo end-user.
@@ -118,6 +119,7 @@
33. 增加 Demo 的显示设置 33. 增加 Demo 的显示设置
34. 增加清除质检数据 34. 增加清除质检数据
35. 优化至odoo14适用 35. 优化至odoo14适用
36. 可为多个模块强制更新翻译
""", """,
'images': ['static/description/banner.gif'], 'images': ['static/description/banner.gif'],
'depends': [ 'depends': [

View File

@@ -24,6 +24,20 @@ class IrModule(models.Model):
modules = self.browse(self.env.context.get('active_ids')) modules = self.browse(self.env.context.get('active_ids'))
[module.button_immediate_uninstall() for module in modules if module not in ['base', 'web']] [module.button_immediate_uninstall() for module in modules if module not in ['base', 'web']]
# 更新翻译,当前语言
def module_multi_refresh_po(self):
lang = self.env.user.lang
modules = self.browse(self.env.context.get('active_ids'))
# 先清理, odoo原生经常清理不干净
for rec in modules:
translate = self.env['ir.translation'].search([
('lang', '=', lang),
('module', '=', rec.name)
])
translate.sudo().unlink()
# 再重载
self.sudo().with_context(overwrite=True)._update_translations(lang)
def button_get_po(self): def button_get_po(self):
self.ensure_one() self.ensure_one()
action = self.env.ref('app_odoo_customize.action_server_module_multi_get_po').read()[0] action = self.env.ref('app_odoo_customize.action_server_module_multi_get_po').read()[0]

View File

@@ -10,4 +10,14 @@
</field> </field>
</field> </field>
</record> </record>
<record id="app_view_translation_search" model="ir.ui.view">
<field name="name">app.ir.translation.search</field>
<field name="model">ir.translation</field>
<field name="inherit_id" ref="base.view_translation_search"/>
<field name="arch" type="xml">
<field name="value" position="after">
<field name="module"/>
</field>
</field>
</record>
</odoo> </odoo>

View File

@@ -13,6 +13,18 @@
</field> </field>
</record> </record>
<record id="action_server_module_multi_refresh_po" model="ir.actions.server">
<field name="name">Refresh Module Translation</field>
<field name="type">ir.actions.server</field>
<field name="binding_model_id" ref="base.model_ir_module_module" />
<field name="model_id" ref="base.model_ir_module_module" />
<field name="state">code</field>
<field name="code">
if records:
records.module_multi_refresh_po()
</field>
</record>
<record id="action_server_module_multi_get_po" model="ir.actions.act_window"> <record id="action_server_module_multi_get_po" model="ir.actions.act_window">
<field name="name">Export Translation</field> <field name="name">Export Translation</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>