Browse Source

[ADD] import help feature + security + menu + french translation

pull/46/head
Cédric Pigeon 10 years ago
parent
commit
5314375795
  1. 6
      help_online/__openerp__.py
  2. 222
      help_online/i18n/fr_BE.po
  3. 1
      help_online/models/__init__.py
  4. 6
      help_online/models/export_help_wizard.py
  5. 49
      help_online/models/import_help_wizard.py
  6. 32
      help_online/security/help_online_rules.xml
  7. 15
      help_online/views/help_online_view.xml
  8. 46
      help_online/views/import_help_wizard_view.xml
  9. 2
      help_online/views/ir_ui_view_view.xml

6
help_online/__openerp__.py

@ -47,10 +47,12 @@ The help pages are created and managed via the website Module.
'data': [ 'data': [
'data/help_auto_backup.xml', # must always be the first 'data/help_auto_backup.xml', # must always be the first
'security/help_online_groups.xml', 'security/help_online_groups.xml',
'security/help_online_rules.xml',
'views/export_help_wizard_view.xml',
'views/import_help_wizard_view.xml',
'views/ir_ui_view_view.xml',
'views/help_online_view.xml', 'views/help_online_view.xml',
'views/website_help_online.xml', 'views/website_help_online.xml',
'views/ir_ui_view_view.xml',
'views/export_help_wizard_view.xml',
'data/ir_config_parameter_data.xml', 'data/ir_config_parameter_data.xml',
], ],
'qweb': [ 'qweb': [

222
help_online/i18n/fr_BE.po

@ -0,0 +1,222 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * help_online
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-10-14 09:06+0000\n"
"PO-Revision-Date: 2014-10-14 09:06+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: help_online
#. openerp-web
#: code:addons/help_online/static/src/js/help_online.js:83
#, python-format
msgid "Cancel"
msgstr "Annuler"
#. module: help_online
#: view:export.help.wizard:help_online.export_help_wizard_view
#: view:import.help.wizard:help_online.import_help_wizard_view
msgid "Close"
msgstr "Fermer"
#. module: help_online
#. openerp-web
#: code:addons/help_online/static/src/js/help_online.js:81
#, python-format
msgid "Confirm"
msgstr "Confirmer"
#. module: help_online
#: code:addons/help_online/models/help_online.py:60
#, python-format
msgid "Create Help page for %s"
msgstr "Créer lapage d'aide pour %s"
#. module: help_online
#: field:export.help.wizard,create_uid:0
#: field:help.online,create_uid:0
#: field:import.help.wizard,create_uid:0
msgid "Created by"
msgstr "Créé par"
#. module: help_online
#: field:export.help.wizard,create_date:0
#: field:help.online,create_date:0
#: field:import.help.wizard,create_date:0
msgid "Created on"
msgstr "Créé le"
#. module: help_online
#: view:export.help.wizard:help_online.export_help_wizard_view
msgid "Export"
msgstr "Export"
#. module: help_online
#: model:ir.actions.act_window,name:help_online.action_export_help_wizard
msgid "Export Help"
msgstr "Export Help"
#. module: help_online
#: view:export.help.wizard:help_online.export_help_wizard_view
msgid "Export Help Data"
msgstr "Export des pages d'aide"
#. module: help_online
#: model:ir.model,name:help_online.model_export_help_wizard
#: model:ir.ui.menu,name:help_online.menu_help_export
msgid "Export Help Online"
msgstr "Export des pages d'aide"
#. module: help_online
#: field:export.help.wizard,export_filename:0
msgid "Export XML Filename"
msgstr "Fichier XML"
#. module: help_online
#: model:ir.ui.menu,name:help_online.menu_help
#: model:ir.ui.menu,name:help_online.menu_help_main
msgid "Help Online"
msgstr "Aide en ligne"
#. module: help_online
#: code:addons/help_online/models/help_online.py:55
#, python-format
msgid "Help on %s"
msgstr "Aide sur %s"
#. module: help_online
#: model:res.groups,name:help_online.help_online_group_reader
msgid "Help reader"
msgstr "Aide: lecteur"
#. module: help_online
#: model:res.groups,name:help_online.help_online_group_writer
msgid "Help writer"
msgstr "Aide: rédacteur"
#. module: help_online
#: field:export.help.wizard,id:0
#: field:help.online,id:0
#: field:import.help.wizard,id:0
msgid "ID"
msgstr "ID"
#. module: help_online
#: view:import.help.wizard:help_online.import_help_wizard_view
msgid "Import"
msgstr "Import"
#. module: help_online
#: model:ir.actions.act_window,name:help_online.action_import_help_wizard
msgid "Import Help"
msgstr "Import des pages d'aide"
#. module: help_online
#: view:import.help.wizard:help_online.import_help_wizard_view
msgid "Import Help Data"
msgstr "Import des pages d'aide"
#. module: help_online
#: model:ir.ui.menu,name:help_online.menu_help_import
msgid "Import Help Online"
msgstr "Import des pages d'aide"
#. module: help_online
#: field:export.help.wizard,write_uid:0
#: field:help.online,write_uid:0
#: field:import.help.wizard,write_uid:0
msgid "Last Updated by"
msgstr "Mis à jour par"
#. module: help_online
#: field:export.help.wizard,write_date:0
#: field:help.online,write_date:0
#: field:import.help.wizard,write_date:0
msgid "Last Updated on"
msgstr "Mis à jour le"
#. module: help_online
#: code:addons/help_online/models/export_help_wizard.py:238
#, python-format
msgid "No data to export !"
msgstr "Aucune page à exporter !"
#. module: help_online
#: code:addons/help_online/models/help_online.py:33
#, python-format
msgid "No page prefix parameter specified !"
msgstr "Le paramètre spécifiant le préfixe des page n'est pas configuré !"
#. module: help_online
#. openerp-web
#: code:addons/help_online/static/src/js/help_online.js:88
#, python-format
msgid "Ok"
msgstr "Ok"
#. module: help_online
#. openerp-web
#: code:addons/help_online/static/src/js/help_online.js:107
#, python-format
msgid "Page does not exist. Do you want to create?"
msgstr "La page n'existe pas. Voulez-vous la créer?"
#. module: help_online
#: field:import.help.wizard,source_file:0
msgid "Source File"
msgstr "Fichier de données"
#. module: help_online
#: view:export.help.wizard:help_online.export_help_wizard_view
msgid "This wizard allow you to export all QWeb views\n"
" related to help online. The result will be an Odoo\n"
" data xml file."
msgstr "Cet assistant vous permet d'exporter toutes les vues QWeb \n"
" concernant l'aide. Le résultat sera un\n"
" fichier de données Odoo."
#. module: help_online
#: view:import.help.wizard:help_online.import_help_wizard_view
msgid "This wizard allow you to import QWeb views\n"
" related to help online. The required file format is an Odoo\n"
" data xml file."
msgstr "Cet assistant vous permet d'importer toutes les vues QWeb\n"
" concernant l'aide. Le format de fichier requis est un\n"
" fichier de données Odoo."
#. module: help_online
#: code:addons/help_online/models/export_help_wizard.py:275
#, python-format
msgid "Unable to write autobackup file in given directory: %s"
msgstr "Impossible d'écrire le fichier de sauvegarde dans le répertoire spécifié: %s"
#. module: help_online
#: view:ir.ui.view:help_online.view_view_search
msgid "Website Page"
msgstr "Page du site"
#. module: help_online
#: view:ir.ui.view:help_online.view_view_form
msgid "Website Page?"
msgstr "Page du site?"
#. module: help_online
#: model:ir.actions.act_window,name:help_online.action_website_pages
#: model:ir.ui.menu,name:help_online.menu_help_pages
msgid "Website Pages"
msgstr "Pages du site"
#. module: help_online
#: field:export.help.wizard,data:0
msgid "XML"
msgstr "XML"

1
help_online/models/__init__.py

@ -20,4 +20,5 @@
############################################################################## ##############################################################################
from . import help_online from . import help_online
from . import export_help_wizard from . import export_help_wizard
from . import import_help_wizard
from . import ir_model from . import ir_model

6
help_online/models/export_help_wizard.py

@ -50,9 +50,10 @@ class ExportHelpWizard(models.TransientModel):
- Replace db id in url with xml id - Replace db id in url with xml id
''' '''
def substitute_id_by_xml_id():
def substitute_id_by_xml_id(img_elem):
new_src = False new_src = False
attach_id = False attach_id = False
img_src = img_elem.get('src')
if 'id=' in img_src: if 'id=' in img_src:
id_pos = img_src.index('id=') + 3 id_pos = img_src.index('id=') + 3
attach_id = img_elem.get('src')[id_pos:] attach_id = img_elem.get('src')[id_pos:]
@ -71,9 +72,8 @@ class ExportHelpWizard(models.TransientModel):
i_img += 1 i_img += 1
xml_id = "%s_img_%s" % \ xml_id = "%s_img_%s" % \
(page_node.attrib['name'], str(i_img).rjust(2, '0')) (page_node.attrib['name'], str(i_img).rjust(2, '0'))
img_src = img_elem.get('src')
new_src, attach_id = substitute_id_by_xml_id()
new_src, attach_id = substitute_id_by_xml_id(img_elem)
if not attach_id: if not attach_id:
continue continue

49
help_online/models/import_help_wizard.py

@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
# All Rights Reserved
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs.
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly advised to contact a Free Software
# Service Company.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp import models, fields, api
from openerp.tools import convert
import base64
from cStringIO import StringIO
class ImportHelpWizard(models.TransientModel):
_name = "import.help.wizard"
source_file = fields.Binary('Source File')
@api.one
def import_help(self):
source_file = base64.decodestring(self.source_file)
convert.convert_xml_import(self.env.cr,
self._module,
StringIO(source_file),
idref=None,
mode='init',
noupdate=False,
report=None)

32
help_online/security/help_online_rules.xml

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="online_help_confidential_rule" model="ir.rule">
<field name="name">Online Help Hidden by Default</field>
<field name="model_id" ref="base.model_ir_ui_view"/>
<field name="domain_force">[
'|',
('type', '!=', 'qweb'),
('name','not like','help-%'),
]</field>
<field name="groups" eval="[(6, 0, [
ref('base.group_portal'),
ref('base.group_public'),
ref('base.group_user'),
])]"/>
<field name="perm_read" eval="1"/><field name="perm_write" eval="0"/>
<field name="perm_create" eval="0"/><field name="perm_unlink" eval="0"/>
</record>
<record id="online_help_reader_rule" model="ir.rule">
<field name="name">Online Help for Help Reader</field>
<field name="model_id" ref="base.model_ir_ui_view"/>
<field name="domain_force">[(1, '=', 1)]</field>
<field name="groups" eval="[(6, 0, [
ref('help_online.help_online_group_reader'),
])]"/>
<field name="perm_read" eval="1"/><field name="perm_write" eval="0"/>
<field name="perm_create" eval="0"/><field name="perm_unlink" eval="0"/>
</record>
</data>
</openerp>

15
help_online/views/help_online_view.xml

@ -9,5 +9,20 @@
<script type="text/javascript" src="/help_online/static/src/js/help_online.js"></script> <script type="text/javascript" src="/help_online/static/src/js/help_online.js"></script>
</xpath> </xpath>
</template> </template>
<record model="ir.actions.act_window" id="action_website_pages">
<field name="name">Website Pages</field>
<field name="res_model">ir.ui.view</field>
<field name="search_view_id" ref="view_view_search" />
<field name="view_type">form</field>
<field name="view_mode">tree, form</field>
<field name="context">{"search_default_website":1}</field>
</record>
<menuitem id="menu_help_main" name="Help Online" groups="help_online_group_writer"/>
<menuitem id="menu_help" name="Help Online" parent="menu_help_main" sequence="90" groups="help_online_group_writer"/>
<menuitem id="menu_help_pages" name="Website Pages" parent="menu_help" sequence="10" action="action_website_pages" groups="help_online_group_writer"/>
<menuitem id="menu_help_import" name="Import Help Online" parent="menu_help" sequence="20" action="action_import_help_wizard" groups="help_online_group_writer"/>
<menuitem id="menu_help_export" name="Export Help Online" parent="menu_help" sequence="30" action="action_export_help_wizard" groups="help_online_group_writer"/>
</data> </data>
</openerp> </openerp>

46
help_online/views/import_help_wizard_view.xml

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record model="ir.ui.view" id="import_help_wizard_view">
<field name="name">import.help.wizard.view</field>
<field name="model">import.help.wizard</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Import Help Data">
<group>
<p>
This wizard allow you to import QWeb views
related to help online. The required file format is an Odoo
data xml file.
</p>
</group>
<group>
<field name="source_file"/>
</group>
<footer>
<span name="go-wizard" attrs="{'invisible': [('source_file', '=', False)]}">
<button name="import_help"
string="Import"
type="object"
icon="gtk-execute"
class="oe_highlight" />
or
</span>
<button string="Close" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_import_help_wizard">
<field name="name">Import Help</field>
<field name="res_model">import.help.wizard</field>
<field name="view_id" ref="import_help_wizard_view"/>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="type">ir.actions.act_window</field>
</record>
</data>
</openerp>

2
help_online/views/ir_ui_view_view.xml

@ -8,7 +8,7 @@
<field name="model">ir.ui.view</field> <field name="model">ir.ui.view</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//filter[@string='QWeb']" position="after"> <xpath expr="//filter[@string='QWeb']" position="after">
<filter string="Website Page" domain="[('type', '=', 'qweb'),('page', '=', True)]"/>
<filter name="website" string="Website Page" domain="[('type', '=', 'qweb'),('page', '=', True)]"/>
</xpath> </xpath>
</field> </field>
</record> </record>

Loading…
Cancel
Save