[IMP] : black, isort, prettier
This commit is contained in:
parent
fd6aad43f5
commit
ddf0ea4d1e
@ -1,14 +1,13 @@
|
|||||||
/* Copyright 2018 David Juaneda
|
/* Copyright 2018 David Juaneda
|
||||||
* License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). */
|
* License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). */
|
||||||
odoo.define('mail.Chatter.activity', function (require) {
|
odoo.define("mail.Chatter.activity", function (require) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var chatter = require('mail.Chatter');
|
var chatter = require("mail.Chatter");
|
||||||
|
|
||||||
chatter.include({
|
chatter.include({
|
||||||
|
|
||||||
events: _.extend({}, chatter.prototype.events, {
|
events: _.extend({}, chatter.prototype.events, {
|
||||||
'click .o_chatter_button_list_activity': '_onListActivity',
|
"click .o_chatter_button_list_activity": "_onListActivity",
|
||||||
}),
|
}),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -19,15 +18,14 @@ odoo.define('mail.Chatter.activity', function (require) {
|
|||||||
_onListActivity: function () {
|
_onListActivity: function () {
|
||||||
this._rpc({
|
this._rpc({
|
||||||
model: this.record.model,
|
model: this.record.model,
|
||||||
method: 'redirect_to_activities',
|
method: "redirect_to_activities",
|
||||||
args: [[]],
|
args: [[]],
|
||||||
kwargs: {
|
kwargs: {
|
||||||
'id':this.record.res_id,
|
id: this.record.res_id,
|
||||||
'model':this.record.model,
|
model: this.record.model,
|
||||||
},
|
},
|
||||||
context: this.record.getContext(),
|
context: this.record.getContext(),
|
||||||
}).then($.proxy(this, "do_action"));
|
}).then($.proxy(this, "do_action"));
|
||||||
},
|
},
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,11 +1,16 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<templates id="template" xml:space="preserve">
|
<templates id="template" xml:space="preserve">
|
||||||
|
|
||||||
<t t-extend="mail.chatter.Buttons">
|
<t t-extend="mail.chatter.Buttons">
|
||||||
<t t-jquery="button.o_chatter_button_schedule_activity" t-operation="after">
|
<t t-jquery="button.o_chatter_button_schedule_activity" t-operation="after">
|
||||||
<button t-if="scheduleActivityButton" class="btn btn-link o_chatter_button_list_activity"
|
<button
|
||||||
title="See activities list" type="button" disabled="disabled">
|
t-if="scheduleActivityButton"
|
||||||
<i class="fa fa-list"/> Activities
|
class="btn btn-link o_chatter_button_list_activity"
|
||||||
|
title="See activities list"
|
||||||
|
type="button"
|
||||||
|
disabled="disabled"
|
||||||
|
>
|
||||||
|
<i class="fa fa-list" /> Activities
|
||||||
</button>
|
</button>
|
||||||
</t>
|
</t>
|
||||||
</t>
|
</t>
|
||||||
|
@ -138,10 +138,10 @@ class TestMailActivityBoardMethods(TransactionCase):
|
|||||||
return result.get("fields_views").get(action.get("view_mode"))
|
return result.get("fields_views").get(action.get("view_mode"))
|
||||||
|
|
||||||
def test_open_origin_res_partner(self):
|
def test_open_origin_res_partner(self):
|
||||||
""" This test case checks
|
"""This test case checks
|
||||||
- If the method redirects to the form view of the correct one
|
- If the method redirects to the form view of the correct one
|
||||||
of an object of the 'res.partner' class to which the activity
|
of an object of the 'res.partner' class to which the activity
|
||||||
belongs.
|
belongs.
|
||||||
"""
|
"""
|
||||||
# Id of the form view for the class 'crm.lead', type 'lead'
|
# Id of the form view for the class 'crm.lead', type 'lead'
|
||||||
form_view_partner_id = self.env.ref("base.view_partner_form").id
|
form_view_partner_id = self.env.ref("base.view_partner_form").id
|
||||||
@ -165,9 +165,9 @@ class TestMailActivityBoardMethods(TransactionCase):
|
|||||||
self.assertEqual(form_view_partner_id, view.get("view_id"))
|
self.assertEqual(form_view_partner_id, view.get("view_id"))
|
||||||
|
|
||||||
def test_redirect_to_activities(self):
|
def test_redirect_to_activities(self):
|
||||||
""" This test case checks
|
"""This test case checks
|
||||||
- if the method returns the correct action,
|
- if the method returns the correct action,
|
||||||
- if the correct activities are shown.
|
- if the correct activities are shown.
|
||||||
"""
|
"""
|
||||||
action_id = self.env.ref("mail_activity_board.open_boards_activities").id
|
action_id = self.env.ref("mail_activity_board.open_boards_activities").id
|
||||||
action = self.partner_client.redirect_to_activities(
|
action = self.partner_client.redirect_to_activities(
|
||||||
|
@ -12,38 +12,57 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Activity Form" create="false" edit="false" delete="false">
|
<form string="Activity Form" create="false" edit="false" delete="false">
|
||||||
<sheet string="Activity">
|
<sheet string="Activity">
|
||||||
<button name="open_origin" type="object" class="centre oe_link" nolabel="1">
|
<button
|
||||||
<h1><field name="res_name"/></h1>
|
name="open_origin"
|
||||||
|
type="object"
|
||||||
|
class="centre oe_link"
|
||||||
|
nolabel="1"
|
||||||
|
>
|
||||||
|
<h1><field name="res_name" /></h1>
|
||||||
</button>
|
</button>
|
||||||
<field name="activity_category" invisible="1" />
|
<field name="activity_category" invisible="1" />
|
||||||
<field name="res_model" invisible="1"/>
|
<field name="res_model" invisible="1" />
|
||||||
<field name="res_model_id" invisible="1"/>
|
<field name="res_model_id" invisible="1" />
|
||||||
<field name="res_id" invisible="1"/>
|
<field name="res_id" invisible="1" />
|
||||||
<group>
|
<group>
|
||||||
<group>
|
<group>
|
||||||
<field name="activity_type_id" required="1" options="{'no_create': True, 'no_open': True}"/>
|
<field
|
||||||
<field name="res_model_id_name"/>
|
name="activity_type_id"
|
||||||
<field name="calendar_event_id" invisible="1"/>
|
required="1"
|
||||||
<field name="create_date" invisible="1"/>
|
options="{'no_create': True, 'no_open': True}"
|
||||||
|
/>
|
||||||
|
<field name="res_model_id_name" />
|
||||||
|
<field name="calendar_event_id" invisible="1" />
|
||||||
|
<field name="create_date" invisible="1" />
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<field name="date_deadline"
|
<field
|
||||||
attrs="{'invisible': [('activity_category', '=', 'meeting')]}"/>
|
name="date_deadline"
|
||||||
<field name="calendar_event_id_start" string="Start meeting"
|
attrs="{'invisible': [('activity_category', '=', 'meeting')]}"
|
||||||
attrs="{'invisible': [('calendar_event_id','=', False)]}"/>
|
/>
|
||||||
<field name="duration" widget="float_time"
|
<field
|
||||||
attrs="{'invisible': ['|',('duration', '=', False),
|
name="calendar_event_id_start"
|
||||||
('calendar_event_id','=', False)]}"/>
|
string="Start meeting"
|
||||||
<field name="user_id" options="{'no_open': True}"/>
|
attrs="{'invisible': [('calendar_event_id','=', False)]}"
|
||||||
|
/>
|
||||||
|
<field
|
||||||
|
name="duration"
|
||||||
|
widget="float_time"
|
||||||
|
attrs="{'invisible': ['|',('duration', '=', False),
|
||||||
|
('calendar_event_id','=', False)]}"
|
||||||
|
/>
|
||||||
|
<field name="user_id" options="{'no_open': True}" />
|
||||||
|
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<group attrs="{'invisible': ['|',('calendar_event_id','=', False),('calendar_event_id_partner_ids','=', False)]}">
|
<group
|
||||||
<field name="calendar_event_id_partner_ids" mode="kanban"/>
|
attrs="{'invisible': ['|',('calendar_event_id','=', False),('calendar_event_id_partner_ids','=', False)]}"
|
||||||
|
>
|
||||||
|
<field name="calendar_event_id_partner_ids" mode="kanban" />
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<field name="summary" placeholder="e.g. Discuss proposal"/>
|
<field name="summary" placeholder="e.g. Discuss proposal" />
|
||||||
<field name="note" placeholder="Log a note..."/>
|
<field name="note" placeholder="Log a note..." />
|
||||||
</group>
|
</group>
|
||||||
</sheet>
|
</sheet>
|
||||||
</form>
|
</form>
|
||||||
@ -55,13 +74,19 @@
|
|||||||
<record id="mail_activity_view_tree" model="ir.ui.view">
|
<record id="mail_activity_view_tree" model="ir.ui.view">
|
||||||
<field name="name">mail.activity.boards.view.tree</field>
|
<field name="name">mail.activity.boards.view.tree</field>
|
||||||
<field name="model">mail.activity</field>
|
<field name="model">mail.activity</field>
|
||||||
<field name="inherit_id" ref="mail.mail_activity_view_tree"/>
|
<field name="inherit_id" ref="mail.mail_activity_view_tree" />
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//tree" position="attributes">
|
<xpath expr="//tree" position="attributes">
|
||||||
<attribute name="default_order"/>
|
<attribute name="default_order" />
|
||||||
<attribute name="decoration-danger">(date_deadline < current_date)</attribute>
|
<attribute
|
||||||
<attribute name="decoration-warning">(date_deadline == current_date)</attribute>
|
name="decoration-danger"
|
||||||
<attribute name="decoration-success">(date_deadline > current_date)</attribute>
|
>(date_deadline < current_date)</attribute>
|
||||||
|
<attribute
|
||||||
|
name="decoration-warning"
|
||||||
|
>(date_deadline == current_date)</attribute>
|
||||||
|
<attribute
|
||||||
|
name="decoration-success"
|
||||||
|
>(date_deadline > current_date)</attribute>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|
||||||
</field>
|
</field>
|
||||||
@ -72,66 +97,103 @@
|
|||||||
<record id="mail_activity_view_kanban" model="ir.ui.view">
|
<record id="mail_activity_view_kanban" model="ir.ui.view">
|
||||||
<field name="name">mail.activity.boards.view.kanban</field>
|
<field name="name">mail.activity.boards.view.kanban</field>
|
||||||
<field name="model">mail.activity</field>
|
<field name="model">mail.activity</field>
|
||||||
<field name="priority" eval="10"/>
|
<field name="priority" eval="10" />
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<kanban default_group_by="activity_type_id" class="_kanban_small_column o_opportunity_kanban" create="0" _order="date_deadline"
|
<kanban
|
||||||
group_create="false" group_delete="false" group_edit="false">
|
default_group_by="activity_type_id"
|
||||||
<field name="user_id"/>
|
class="_kanban_small_column o_opportunity_kanban"
|
||||||
<field name="res_id"/>
|
create="0"
|
||||||
<field name="res_name"/>
|
_order="date_deadline"
|
||||||
<field name="res_model"/>
|
group_create="false"
|
||||||
<field name="summary"/>
|
group_delete="false"
|
||||||
<field name="date_deadline"/>
|
group_edit="false"
|
||||||
<field name="state"/>
|
>
|
||||||
<field name="icon"/>
|
<field name="user_id" />
|
||||||
<field name="activity_type_id"/>
|
<field name="res_id" />
|
||||||
<field name="activity_category"/>
|
<field name="res_name" />
|
||||||
|
<field name="res_model" />
|
||||||
|
<field name="summary" />
|
||||||
|
<field name="date_deadline" />
|
||||||
|
<field name="state" />
|
||||||
|
<field name="icon" />
|
||||||
|
<field name="activity_type_id" />
|
||||||
|
<field name="activity_category" />
|
||||||
<templates>
|
<templates>
|
||||||
<t t-name="kanban-box">
|
<t t-name="kanban-box">
|
||||||
<div t-attf-class="oe_kanban_content oe_kanban_global_click">
|
<div t-attf-class="oe_kanban_content oe_kanban_global_click">
|
||||||
<div class="oe_kanban_content">
|
<div class="oe_kanban_content">
|
||||||
<div>
|
<div>
|
||||||
<strong class="o_kanban_record_subtitle">
|
<strong class="o_kanban_record_subtitle">
|
||||||
<span t-attf-class="fa #{record.icon.raw_value}" />
|
<span
|
||||||
<field name="summary"/>
|
t-attf-class="fa #{record.icon.raw_value}"
|
||||||
|
/>
|
||||||
|
<field name="summary" />
|
||||||
</strong>
|
</strong>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<strong class="o_kanban_record_title"><field name="res_name"/></strong>
|
<strong class="o_kanban_record_title"><field
|
||||||
|
name="res_name"
|
||||||
|
/></strong>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="o_kanban_record_bottom">
|
<div class="o_kanban_record_bottom">
|
||||||
<div class="oe_kanban_bottom_left">
|
<div class="oe_kanban_bottom_left">
|
||||||
<t t-set="act_date" t-value="new Date(record.date_deadline.raw_value)"/>
|
<t
|
||||||
|
t-set="act_date"
|
||||||
|
t-value="new Date(record.date_deadline.raw_value)"
|
||||||
|
/>
|
||||||
<t t-if="act_date < (new Date())">
|
<t t-if="act_date < (new Date())">
|
||||||
<span t-attf-class="text-danger"><i class="fa fa-clock-o"/></span>
|
<span t-attf-class="text-danger"><i
|
||||||
<t t-if="record.activity_category.raw_value!='meeting'">
|
class="fa fa-clock-o"
|
||||||
|
/></span>
|
||||||
|
<t
|
||||||
|
t-if="record.activity_category.raw_value!='meeting'"
|
||||||
|
>
|
||||||
<span t-attf-class="text-danger">
|
<span t-attf-class="text-danger">
|
||||||
<field name="date_deadline" t-options='{"widget": "date"}'/>
|
<field
|
||||||
|
name="date_deadline"
|
||||||
|
t-options='{"widget": "date"}'
|
||||||
|
/>
|
||||||
</span>
|
</span>
|
||||||
</t>
|
</t>
|
||||||
<t t-else="">
|
<t t-else="">
|
||||||
<span t-attf-class="text-danger">
|
<span t-attf-class="text-danger">
|
||||||
<field name="calendar_event_id_start" t-options='{"widget": "date"}'/>
|
<field
|
||||||
|
name="calendar_event_id_start"
|
||||||
|
t-options='{"widget": "date"}'
|
||||||
|
/>
|
||||||
</span>
|
</span>
|
||||||
</t>
|
</t>
|
||||||
</t>
|
</t>
|
||||||
<t t-else="">
|
<t t-else="">
|
||||||
<span><i class="fa fa-clock-o"/></span>
|
<span><i class="fa fa-clock-o" /></span>
|
||||||
<t t-if="record.activity_category.raw_value!='meeting'">
|
<t
|
||||||
|
t-if="record.activity_category.raw_value!='meeting'"
|
||||||
|
>
|
||||||
<span>
|
<span>
|
||||||
<field name="date_deadline" t-options='{"widget": "date"}'/>
|
<field
|
||||||
|
name="date_deadline"
|
||||||
|
t-options='{"widget": "date"}'
|
||||||
|
/>
|
||||||
</span>
|
</span>
|
||||||
</t>
|
</t>
|
||||||
<t t-else="">
|
<t t-else="">
|
||||||
<field name="calendar_event_id_start" t-options='{"widget": "date"}'/>
|
<field
|
||||||
|
name="calendar_event_id_start"
|
||||||
|
t-options='{"widget": "date"}'
|
||||||
|
/>
|
||||||
</t>
|
</t>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
<div class="oe_kanban_bottom_right">
|
<div class="oe_kanban_bottom_right">
|
||||||
<img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)"
|
<img
|
||||||
t-att-title="record.user_id.value"
|
t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)"
|
||||||
t-att-alt="record.user_id.value" width="24" height="24" class="oe_kanban_avatar"/>
|
t-att-title="record.user_id.value"
|
||||||
|
t-att-alt="record.user_id.value"
|
||||||
|
width="24"
|
||||||
|
height="24"
|
||||||
|
class="oe_kanban_avatar"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -147,28 +209,42 @@
|
|||||||
<record id="mail_activity_view_search" model="ir.ui.view">
|
<record id="mail_activity_view_search" model="ir.ui.view">
|
||||||
<field name="name">mail.activity.boards.view.search</field>
|
<field name="name">mail.activity.boards.view.search</field>
|
||||||
<field name="model">mail.activity</field>
|
<field name="model">mail.activity</field>
|
||||||
<field name="inherit_id" ref="mail.mail_activity_view_search"/>
|
<field name="inherit_id" ref="mail.mail_activity_view_search" />
|
||||||
<field name="priority" eval="2"/>
|
<field name="priority" eval="2" />
|
||||||
<field name="mode">primary</field>
|
<field name="mode">primary</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr='//field[@name="res_model_id"]' position='before'>
|
<xpath expr='//field[@name="res_model_id"]' position='before'>
|
||||||
<field name="user_id"/>
|
<field name="user_id" />
|
||||||
<field name="res_name" string="Origin"/>
|
<field name="res_name" string="Origin" />
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|
||||||
<xpath expr='//filter[@name="activities_overdue"]' position='before'>
|
<xpath expr='//filter[@name="activities_overdue"]' position='before'>
|
||||||
<filter string="Act. next month" name="activities_month"
|
<filter
|
||||||
domain="[('date_deadline', '<', (context_today()+datetime.timedelta(days=30)).strftime('%Y-%m-%d'))]"
|
string="Act. next month"
|
||||||
help="Show activities scheduled for next month."/>
|
name="activities_month"
|
||||||
<filter string="Act. next 6 months" name="activities_6_month"
|
domain="[('date_deadline', '<', (context_today()+datetime.timedelta(days=30)).strftime('%Y-%m-%d'))]"
|
||||||
domain="[('date_deadline', '<', (context_today()+datetime.timedelta(days=180)).strftime('%Y-%m-%d'))]"
|
help="Show activities scheduled for next month."
|
||||||
help="Show activities scheduled for next 6 months."/>
|
/>
|
||||||
<separator/>
|
<filter
|
||||||
|
string="Act. next 6 months"
|
||||||
|
name="activities_6_month"
|
||||||
|
domain="[('date_deadline', '<', (context_today()+datetime.timedelta(days=180)).strftime('%Y-%m-%d'))]"
|
||||||
|
help="Show activities scheduled for next 6 months."
|
||||||
|
/>
|
||||||
|
<separator />
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|
||||||
<xpath expr='//search/group' position='inside'>
|
<xpath expr='//search/group' position='inside'>
|
||||||
<filter string="User" name='assigned_user' context="{'group_by':'user_id'}"/>
|
<filter
|
||||||
<filter string="Origin" name='origin' context="{'group_by': 'res_model_id'}"/>
|
string="User"
|
||||||
|
name='assigned_user'
|
||||||
|
context="{'group_by':'user_id'}"
|
||||||
|
/>
|
||||||
|
<filter
|
||||||
|
string="Origin"
|
||||||
|
name='origin'
|
||||||
|
context="{'group_by': 'res_model_id'}"
|
||||||
|
/>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|
||||||
</field>
|
</field>
|
||||||
@ -184,15 +260,17 @@
|
|||||||
<field name="view_mode">kanban,form</field>
|
<field name="view_mode">kanban,form</field>
|
||||||
<field name="domain">[]</field>
|
<field name="domain">[]</field>
|
||||||
<field name="context">{}</field>
|
<field name="context">{}</field>
|
||||||
<field name="view_ids"
|
<field
|
||||||
eval="[(5, 0, 0),
|
name="view_ids"
|
||||||
|
eval="[(5, 0, 0),
|
||||||
(0, 0, {'view_mode': 'kanban', 'view_id': ref('mail_activity_view_kanban')}),
|
(0, 0, {'view_mode': 'kanban', 'view_id': ref('mail_activity_view_kanban')}),
|
||||||
(0, 0, {'view_mode': 'tree', 'view_id': ref('mail_activity_view_tree')}),
|
(0, 0, {'view_mode': 'tree', 'view_id': ref('mail_activity_view_tree')}),
|
||||||
(0, 0, {'view_mode': 'form', 'view_id': ref('mail_activity_view_form_board')}),
|
(0, 0, {'view_mode': 'form', 'view_id': ref('mail_activity_view_form_board')}),
|
||||||
(0, 0, {'view_mode': 'calendar'}),
|
(0, 0, {'view_mode': 'calendar'}),
|
||||||
(0, 0, {'view_mode': 'pivot'}),
|
(0, 0, {'view_mode': 'pivot'}),
|
||||||
(0, 0, {'view_mode': 'graph'})]"/>
|
(0, 0, {'view_mode': 'graph'})]"
|
||||||
<field name="search_view_id" ref="mail_activity_view_search"/>
|
/>
|
||||||
|
<field name="search_view_id" ref="mail_activity_view_search" />
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|
||||||
@ -200,10 +278,11 @@
|
|||||||
Menus
|
Menus
|
||||||
-->
|
-->
|
||||||
<menuitem
|
<menuitem
|
||||||
id="board_menu_activities"
|
id="board_menu_activities"
|
||||||
name="Activities"
|
name="Activities"
|
||||||
parent="base.menu_board_root"
|
parent="base.menu_board_root"
|
||||||
action="open_boards_activities"
|
action="open_boards_activities"
|
||||||
sequence="1"/>
|
sequence="1"
|
||||||
|
/>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
@ -1,8 +1,15 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<template id="assets_backend" name="mail_activity_board assets" inherit_id="web.assets_backend">
|
<template
|
||||||
|
id="assets_backend"
|
||||||
|
name="mail_activity_board assets"
|
||||||
|
inherit_id="web.assets_backend"
|
||||||
|
>
|
||||||
<xpath expr="." position="inside">
|
<xpath expr="." position="inside">
|
||||||
<script type="text/javascript" src="/mail_activity_board/static/src/js/override_chatter.js"/>
|
<script
|
||||||
|
type="text/javascript"
|
||||||
|
src="/mail_activity_board/static/src/js/override_chatter.js"
|
||||||
|
/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</template>
|
</template>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
Loading…
Reference in New Issue
Block a user