mirror of https://github.com/OCA/web.git
parent
c90c77ff68
commit
4f8b4983e5
|
@ -3,7 +3,7 @@
|
||||||
{
|
{
|
||||||
"name": "Quick Start Screen",
|
"name": "Quick Start Screen",
|
||||||
"summary": "Configurable start screen for quick actions",
|
"summary": "Configurable start screen for quick actions",
|
||||||
"version": "16.0.1.0.0",
|
"version": "18.0.1.0.0",
|
||||||
"author": "Tecnativa, Odoo Community Association (OCA)",
|
"author": "Tecnativa, Odoo Community Association (OCA)",
|
||||||
"website": "https://github.com/OCA/web",
|
"website": "https://github.com/OCA/web",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
"assets": {
|
"assets": {
|
||||||
"web.assets_backend": [
|
"web.assets_backend": [
|
||||||
"web_quick_start_screen/static/src/scss/quick_start_screen.scss",
|
"web_quick_start_screen/static/src/scss/quick_start_screen.scss",
|
||||||
"web_quick_start_screen/static/src/js/kanban_controller.esm.js",
|
"web_quick_start_screen/static/src/js/**/*",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
from odoo import _, api, fields, models, tools
|
from odoo import api, fields, models, tools
|
||||||
|
|
||||||
|
|
||||||
class QuicktStartScreen(models.Model):
|
class QuicktStartScreen(models.Model):
|
||||||
|
@ -40,8 +40,8 @@ class QuicktStartScreen(models.Model):
|
||||||
|
|
||||||
def _prepare_screen_action(self):
|
def _prepare_screen_action(self):
|
||||||
return {
|
return {
|
||||||
"display_name": self.name or _("Start"),
|
"display_name": self.name or self.env._("Start"),
|
||||||
"name": self.name or _("Start"),
|
"name": self.name or self.env._("Start"),
|
||||||
"res_model": "quick.start.screen.action",
|
"res_model": "quick.start.screen.action",
|
||||||
"target": "current",
|
"target": "current",
|
||||||
"type": "ir.actions.act_window",
|
"type": "ir.actions.act_window",
|
||||||
|
|
|
@ -58,6 +58,7 @@ class DecontracStartScreenAction(models.Model):
|
||||||
if self.context:
|
if self.context:
|
||||||
extra_context = self._get_extra_context()
|
extra_context = self._get_extra_context()
|
||||||
# We need to deal with the active_id and overwrite it if needed
|
# We need to deal with the active_id and overwrite it if needed
|
||||||
|
# MIG TODO: Check if this is affected
|
||||||
active_id = extra_context.get("active_id", 0)
|
active_id = extra_context.get("active_id", 0)
|
||||||
action["context"] = dict(
|
action["context"] = dict(
|
||||||
safe_eval(action.get("context", "{}"), {"active_id": active_id}),
|
safe_eval(action.get("context", "{}"), {"active_id": active_id}),
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
/** @odoo-module */
|
|
||||||
/* Copyright 2024 Tecnativa - David Vidal
|
/* Copyright 2024 Tecnativa - David Vidal
|
||||||
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
|
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
|
||||||
import {ControlPanel} from "@web/search/control_panel/control_panel";
|
import {ControlPanel} from "@web/search/control_panel/control_panel";
|
||||||
import {kanbanView} from "@web/views/kanban/kanban_view";
|
import {kanbanView} from "@web/views/kanban/kanban_view";
|
||||||
import {registry} from "@web/core/registry";
|
import {registry} from "@web/core/registry";
|
||||||
const {xml} = owl;
|
|
||||||
|
|
||||||
export class QuickStartScreenControlPanel extends ControlPanel {}
|
export class QuickStartScreenControlPanel extends ControlPanel {
|
||||||
|
static template = "start_screen.ControlPanel";
|
||||||
// We want to remove the control panel from this view.
|
}
|
||||||
QuickStartScreenControlPanel.template = xml`<div class="d-none" />`;
|
|
||||||
|
|
||||||
export const quickStartScreenView = {
|
export const quickStartScreenView = {
|
||||||
...kanbanView,
|
...kanbanView,
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<templates xml:space="preserve">
|
||||||
|
<t
|
||||||
|
t-name="start_screen.ControlPanel"
|
||||||
|
t-inherit="web.ControlPanel"
|
||||||
|
t-inherit-mode="primary"
|
||||||
|
>
|
||||||
|
<xpath expr="//div[hasclass('o_control_panel')]" position="attributes">
|
||||||
|
<attribute name="class" add="d-none" separator=" " />
|
||||||
|
</xpath>
|
||||||
|
</t>
|
||||||
|
</templates>
|
|
@ -1,14 +1,14 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<record id="quick_start_screen_action_tree" model="ir.ui.view">
|
<record id="quick_start_screen_action_list" model="ir.ui.view">
|
||||||
<field name="model">quick.start.screen.action</field>
|
<field name="model">quick.start.screen.action</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree>
|
<list>
|
||||||
<field name="sequence" widget="handle" />
|
<field name="sequence" widget="handle" />
|
||||||
<field name="name" />
|
<field name="name" />
|
||||||
<field name="description" />
|
<field name="description" />
|
||||||
<field name="action_ref_id" groups="base.group_system" />
|
<field name="action_ref_id" groups="base.group_system" />
|
||||||
</tree>
|
</list>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
<record id="quick_start_screen_action_kanban" model="ir.ui.view">
|
<record id="quick_start_screen_action_kanban" model="ir.ui.view">
|
||||||
|
@ -23,50 +23,34 @@
|
||||||
<field name="color" />
|
<field name="color" />
|
||||||
<field name="context" />
|
<field name="context" />
|
||||||
<templates>
|
<templates>
|
||||||
<t t-name="kanban-box">
|
<t t-name="card" class="flex-row">
|
||||||
<div class="col-6 col-md-4 col-lg-3 py-4">
|
<aside class="d-flex align-items-center me-2">
|
||||||
<div class="row m-0 w-100 h-100">
|
<field
|
||||||
<div class="col-lg-4 p-0">
|
t-if="record.image.raw_value"
|
||||||
<div
|
name="image"
|
||||||
class="d-flex w-100 h-100 align-items-start justify-content-center display-3 p-3 text-muted"
|
widget="image"
|
||||||
>
|
options="{'img_class': 'object-fit-contain'}"
|
||||||
<img
|
/>
|
||||||
t-att-src="kanban_image('quick.start.screen.action', 'image', record.id.raw_value)"
|
<i
|
||||||
class="o_image_64_cover"
|
t-else=""
|
||||||
t-if="record.image.raw_value"
|
t-attf-class="fa #{record.icon_name.raw_value or 'fa-flash'} fa-3x o_start_icon_color_#{record.color.raw_value}"
|
||||||
t-att-alt="record.name.raw_value"
|
t-att-title="record.name.raw_value"
|
||||||
/>
|
/>
|
||||||
<i
|
</aside>
|
||||||
t-else=""
|
<main>
|
||||||
t-attf-class="fa #{record.icon_name.raw_value or 'fa-flash'} o_start_icon_color_#{record.color.raw_value}"
|
<h3 class="card-title" t-out="record.name.raw_value" />
|
||||||
/>
|
<a
|
||||||
</div>
|
type="object"
|
||||||
</div>
|
data-reload-on-close="true"
|
||||||
<div class="col-lg-8 p-0">
|
name="run_action"
|
||||||
<div
|
role="button"
|
||||||
class="card-body d-flex flex-column align-items-start justify-content-start h-100"
|
href="#"
|
||||||
>
|
class="btn-lnk stretched-link"
|
||||||
<h3
|
t-att-string="record.name.raw_value"
|
||||||
class="card-title"
|
>
|
||||||
t-out="record.name.raw_value"
|
<span t-out="record.description.raw_value" />
|
||||||
/>
|
</a>
|
||||||
<a
|
</main>
|
||||||
type="object"
|
|
||||||
data-reload-on-close="true"
|
|
||||||
name="run_action"
|
|
||||||
role="button"
|
|
||||||
href="#"
|
|
||||||
class="btn-lnk stretched-link"
|
|
||||||
t-att-string="record.name.raw_value"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
t-out="record.description.raw_value"
|
|
||||||
/>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</t>
|
</t>
|
||||||
</templates>
|
</templates>
|
||||||
</kanban>
|
</kanban>
|
||||||
|
@ -81,15 +65,8 @@
|
||||||
<field name="name" />
|
<field name="name" />
|
||||||
<field name="action_ref_id" groups="base.group_system" />
|
<field name="action_ref_id" groups="base.group_system" />
|
||||||
<field name="description" widget="html" />
|
<field name="description" widget="html" />
|
||||||
<field
|
<field name="icon_name" invisible="image" />
|
||||||
name="icon_name"
|
<field name="color" widget="color_picker" invisible="image" />
|
||||||
attrs="{'invisible': [('image', '!=', False)]}"
|
|
||||||
/>
|
|
||||||
<field
|
|
||||||
name="color"
|
|
||||||
widget="color_picker"
|
|
||||||
attrs="{'invisible': [('image', '!=', False)]}"
|
|
||||||
/>
|
|
||||||
<field name="domain" groups="base.group_system" />
|
<field name="domain" groups="base.group_system" />
|
||||||
<field name="context" groups="base.group_system" />
|
<field name="context" groups="base.group_system" />
|
||||||
<field name="image" widget="image" />
|
<field name="image" widget="image" />
|
||||||
|
@ -101,7 +78,7 @@
|
||||||
<record id="quick_start_screen_action_action" model="ir.actions.act_window">
|
<record id="quick_start_screen_action_action" model="ir.actions.act_window">
|
||||||
<field name="name">Quick Start Screen Actions</field>
|
<field name="name">Quick Start Screen Actions</field>
|
||||||
<field name="res_model">quick.start.screen.action</field>
|
<field name="res_model">quick.start.screen.action</field>
|
||||||
<field name="view_mode">tree,form</field>
|
<field name="view_mode">list,form</field>
|
||||||
</record>
|
</record>
|
||||||
<menuitem
|
<menuitem
|
||||||
id="menu_quick_start_screen_action"
|
id="menu_quick_start_screen_action"
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<odoo>
|
<odoo>
|
||||||
<record id="quick_start_screen_tree_view" model="ir.ui.view">
|
<record id="quick_start_screen_list_view" model="ir.ui.view">
|
||||||
<field name="model">quick.start.screen</field>
|
<field name="model">quick.start.screen</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree editable="top">
|
<list editable="top">
|
||||||
<field name="name" />
|
<field name="name" />
|
||||||
<field
|
<field
|
||||||
name="action_ids"
|
name="action_ids"
|
||||||
|
@ -16,13 +16,13 @@
|
||||||
title="Go to the start screen"
|
title="Go to the start screen"
|
||||||
icon="fa-flash"
|
icon="fa-flash"
|
||||||
/>
|
/>
|
||||||
</tree>
|
</list>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
<record id="start_screen_action_config" model="ir.actions.act_window">
|
<record id="start_screen_action_config" model="ir.actions.act_window">
|
||||||
<field name="res_model">quick.start.screen</field>
|
<field name="res_model">quick.start.screen</field>
|
||||||
<field name="name">Quick Start Screens</field>
|
<field name="name">Quick Start Screens</field>
|
||||||
<field name="view_mode">tree</field>
|
<field name="view_mode">list</field>
|
||||||
</record>
|
</record>
|
||||||
<record id="start_screen_action" model="ir.actions.server">
|
<record id="start_screen_action" model="ir.actions.server">
|
||||||
<field name="name">Quick Start Screen</field>
|
<field name="name">Quick Start Screen</field>
|
||||||
|
|
Loading…
Reference in New Issue