-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add update_translations #21
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2016-2017 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) | ||
|
||
from ..exceptions import AnthemError | ||
|
||
|
||
def uninstall(ctx, module_list): | ||
""" uninstall module """ | ||
if not module_list: | ||
raise AnthemError(u"You have to provide a list of " | ||
"module's name to uninstall") | ||
|
||
mods = ctx.env['ir.module.module'].search([('name', 'in', module_list)]) | ||
try: | ||
mods.button_immediate_uninstall() | ||
except: | ||
raise AnthemError(u'Cannot uninstall modules. See the logs') | ||
|
||
|
||
def update_translations(ctx, module_list): | ||
""" Update translations from module list""" | ||
if not module_list: | ||
raise AnthemError(u"You have to provide a list of " | ||
"module's name to update the translations") | ||
|
||
for module in module_list: | ||
ctx.env['ir.module.module'].with_context(overwrite=True).search( | ||
[('name', '=', module)]).update_translations() |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,17 +2,11 @@ | |
# Copyright 2016-2017 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) | ||
|
||
from ..exceptions import AnthemError | ||
from . import modules | ||
|
||
|
||
def uninstall(ctx, module_list): | ||
""" uninstall module """ | ||
if not module_list: | ||
raise AnthemError(u"You have to provide a list of " | ||
"module's name to uninstall") | ||
|
||
mods = ctx.env['ir.module.module'].search([('name', 'in', module_list)]) | ||
try: | ||
mods.button_immediate_uninstall() | ||
except: | ||
raise AnthemError(u'Cannot uninstall modules. See the logs') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you print a warning using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @guewen Updated! |
||
modules.uninstall(ctx, module_list) | ||
ctx.log_line(u'Deprecated: use anthem.lyrics.modules.uninstall instead of ' | ||
'anthem.lyrics.uninstaller.uninstall') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this is great, but should not be in the
loaders
which should be the place for lyrics that load records (using csv, xml, yaml or whatever).I think we should have a module
modules.py
which containsupdate_translations
anduninstall
(which should be moved fromuninstaller.py
butuninstaller.py
should be kept with a import ofuninstall
for backward compat).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are forcing the reload of po files. But as we target a module, it makes sense to create a new
modules.py
. Doing the change.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@leemannd I just notice now, this code is still there :'-( (and in modules.py as well)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, wouldn't be better since you gonna touch it ;P to do
search([('name', 'in', modules)]).update_translations()
w/out looping?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aaaaaaaaand support
filter_lang=None
to update just one lang when needed