[IMP] base: add dropdown on modules kanban view and add a discover button

Purpose of this commit is to ease application finding and use by improving
kanban view of modules. A dropdown with action is added. It includes a
discover functionality letting users go to the App page see their description.
This page is based on the website of the application.

When a module has a website page it is used as link for the discover feature.
It allow to directly link to a webpage to discover the features of the
application instead of relying on the description and/or index.html that
are not up to date in most applications.

Future commits will gradually remove description from modules that have
a website page in order to use the discover button and avoid having outdated
content.

This commit is related to task 47179 and PR #22689.
This commit is contained in:
Priyanka Kakadiya
2018-08-03 14:53:52 +02:00
committed by Thibault Delavallée
parent aeb381c06e
commit 4ed7690d43
2 changed files with 22 additions and 0 deletions
+7
View File
@@ -445,6 +445,13 @@ class Module(models.Model):
self.write({'state': 'uninstalled', 'demo': False})
return True
@api.multi
def button_discover(self):
return {
'type': 'ir.actions.act_url',
'url': self.website,
}
@assert_log_admin_access
@api.multi
def module_uninstall(self):
@@ -68,6 +68,7 @@
<div>
<button name="button_immediate_install" states="uninstalled" string="Install" type="object" class="btn btn-primary"/>
<button name="button_immediate_upgrade" states="installed" string="Upgrade" type="object" class="btn btn-primary"/>
<button name="button_discover" string="Discover" type="object" attrs="{'invisible':['|', ('website', '=', False), ('application', '=', False)]}" class="btn btn-secondary"/>
<button name="button_uninstall_wizard" states="installed" string="Uninstall" type="object" class="btn btn-secondary"/>
<button name="button_uninstall_cancel" states="to remove" string="Cancel Uninstall" type="object" class="btn btn-secondary"/>
<button name="button_upgrade_cancel" states="to upgrade" string="Cancel Upgrade" type="object" class="btn btn-secondary"/>
@@ -153,10 +154,22 @@
<field name="name"/>
<field name="state"/>
<field name="summary"/>
<field name="website"/>
<field name="application"/>
<templates>
<t t-name="kanban-box">
<div class="oe_module_vignette oe_kanban_global_click">
<t t-set="installed" t-value="record.state.raw_value == 'installed'"/>
<div t-if="installed or record.website.raw_value and record.application.raw_value" class="o_dropdown_kanban dropdown">
<a class="dropdown-toggle o-no-caret btn" data-toggle="dropdown" href="#" role="button" aria-label="Dropdown menu" title="Dropdown menu">
<span class="fa fa-ellipsis-v"/>
</a>
<div class="dropdown-menu" role="menu" aria-labelledby="dLabel">
<a t-if="record.website.raw_value and record.application.raw_value" role="menuitem" class="dropdown-item" t-att-href="record.website.raw_value" target="_blank">Discover</a>
<a t-if="installed" name="button_immediate_upgrade" type="object" role="menuitem" class="dropdown-item">Upgrade</a>
<a t-if="installed" name="button_uninstall_wizard" type="object" role="menuitem" class="dropdown-item">Uninstall</a>
</div>
</div>
<img t-attf-src="#{record.icon.value}" class="oe_module_icon" alt="Icon"/>
<div class="oe_module_desc" t-att-title="record.shortdesc.value">
<h4 class="o_kanban_record_title"><field name="shortdesc"/></h4>
@@ -167,6 +180,8 @@
<code groups="base.group_no_one"><small><field name="name"/></small></code>
<button type="object" class="btn btn-primary float-right" name="button_immediate_install" states="uninstalled">Install</button>
<span t-if="installed" class="float-right text-muted mr8">Installed</span>
<button states="to remove" type="object" class="btn btn-primary float-right" name="button_uninstall_cancel">Cancel UnInstall</button>
<button states="to install" type="object" class="btn btn-primary float-right" name="button_install_cancel">Cancel Install</button>
</div>
</div>
</div>