yaltik_odoo_custom/yaltik_crm_action/views/crm_action_views.xml

200 lines
7.8 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017 Fabien Bourgeois <fabien@yaltik.com>
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/>.
-->
<odoo>
<data>
<!-- Forms -->
<record id="crm_action_form" model="ir.ui.view">
<field name="name">CRM Action Form</field>
<field name="model">crm.action</field>
<field name="arch" type="xml">
<form string="Actions">
<header>
<button name="create_linked_event" string="Create linked event"
type="object" class="oe_highlight"
attrs="{'invisible': ['|', (['event_id', '!=', False]),
('state', '=', 'cancel')]}" />
<button name="remove_linked_event" string="Remove linked event"
type="object" class="oe_highlight"
attrs="{'invisible': [(['event_id', '=', False])]}" />
<field name="state" widget="statusbar" clickable="1" />
</header>
<sheet>
<group>
<field name="action_type_id" />
<field name="date" />
<field name="event_id" readonly="1"
attrs="{'invisible': [('event_id', '=', False)]}" />
<field name="priority" widget="priority" />
<field name="details" width="200" />
<field name="partner_id" />
<field name="lead_id" domain="[('partner_id', '=', partner_id)]"
help="Lead for this action, depends on partner" />
<field name="user_id" />
</group>
</sheet>
</form>
</field>
</record>
<record id="crm_action_type_form" model="ir.ui.view">
<field name="name">CRM Action Type Form</field>
<field name="model">crm.action.type</field>
<field name="arch" type="xml">
<form>
<sheet>
<group>
<field name="name" />
<field name="priority" />
<field name="active" />
</group>
</sheet>
</form>
</field>
</record>
<!-- Trees -->
<record id="crm_action_tree" model="ir.ui.view">
<field name="name">CRM Action Tree</field>
<field name="model">crm.action</field>
<field name="arch" type="xml">
<tree colors="red:date &lt; current_date and state=='draft';blue:date &gt;= current_date and state=='draft';gray: state == 'cancel'">
<field name="action_type_id" />
<field name="priority" />
<field name="date" />
<field name="lead_id" />
<field name="partner_id" />
<field name="user_id" />
<button icon="fa-check" name="set_to_done" type="object"
string="Mark as Done" states="draft" />
<button icon="fa-undo" name="set_to_draft" type="object"
string="Back to Todo" states="done" />
<field name="state" />
</tree>
</field>
</record>
<record id="crm_action_type_tree" model="ir.ui.view">
<field name="name">CRM Action Type Tree</field>
<field name="model">crm.action.type</field>
<field name="arch" type="xml">
<tree editable="top">
<field name="name"/>
<field name="priority"/>
<field name="active"/>
</tree>
</field>
</record>
<!-- Calendars -->
<record id="crm_action_calendar" model="ir.ui.view">
<field name="name">CRM Action Calendar</field>
<field name="model">crm.action</field>
<field name="arch" type="xml">
<calendar string="Actions" color="user_id" date_start="date">
<field name="partner_id" />
<field name="display_name" />
</calendar>
</field>
</record>
<!-- Searches -->
<record model="ir.ui.view" id="crm_action_search">
<field name="name">Search adaptations</field>
<field name="model">crm.action</field>
<field name="arch" type="xml">
<search string="Search Actions">
<field name="lead_id" />
<field name="partner_id" />
<field name="date" />
<field name="user_id" />
<separator/>
<filter string="Todo" name="draft_only"
domain="[('state', '=', 'draft')]"/>
<filter string="Done" name="done_only"
domain="[('state', '=', 'done')]"/>
<separator />
<filter name="urgent" string="Urgent"
domain="[('priority', '=', '4')]" />
<separator/>
<filter string="Todo Today" name="todo_today"
domain="[('state', '=', 'draft'), ('date', '&lt;=', context_today().strftime('%Y-%m-%d'))]" />
<filter name="todo_week" string="Todo within 7 days"
domain="[('state', '=', 'draft'), ('date', '&lt;=', (context_today() + datetime.timedelta(days=7)).strftime('%Y-%m-%d'))]" />
<filter name="todo_month" string="Todo within 30 days"
domain="[('state', '=', 'draft'), ('date', '&lt;=', (context_today() + datetime.timedelta(days=30)).strftime('%Y-%m-%d'))]" />
<separator/>
<filter string="My Actions" name="user_me"
domain="[('user_id', '=', uid)]" help="Actions done by me" />
<group string="Group By" name="groupby">
<filter name="state_groupby" string="State"
context="{'group_by': 'state'}" />
<filter name="priority_groupby" string="Priority"
context="{'group_by': 'priority'}" />
<filter name="partner_groupby" string="Partner"
context="{'group_by': 'partner_id'}" />
<filter name="user_groupby" string="User"
context="{'group_by': 'user_id'}" />
<filter name="action_type_id_groupby" string="Action Type"
context="{'group_by': 'action_type_id'}" />
<filter name="date_groupby" string="Week"
context="{'group_by': 'date:week'}"/>
</group>
</search>
</field>
</record>
<record id="crm_action_type_search" model="ir.ui.view">
<field name="name">CRM Action Type Search</field>
<field name="model">crm.action.type</field>
<field name="arch" type="xml">
<search string="Search Action Types">
<field name="name" />
</search>
</field>
</record>
<!-- Actions -->
<record model="ir.actions.act_window" id="crm_action_action">
<field name="name">Actions</field>
<field name="res_model">crm.action</field>
<field name="view_mode">tree,form,calendar</field>
<field name="context">{'search_default_draft_only': 1, 'search_default_user_me': 1}</field>
</record>
<record id="crm_action_type_action" model="ir.actions.act_window">
<field name="name">Action Types</field>
<field name="res_model">crm.action.type</field>
<field name="view_mode">tree</field>
</record>
<!-- Menus -->
<record id="crm.crm_activity_menu" model="ir.ui.menu">
<field name="active">0</field>
</record>
<record id="crm.crm_lead_menu_activities" model="ir.ui.menu">
<field name="active">0</field>
</record>
<menuitem id="crm_action_menu" name="Actions"
parent="sales_team.menu_sales" sequence="5" action="crm_action_action" />
<menuitem id="crm_action_type_menu" name="Action Types"
action="crm_action_type_action" sequence="0"
parent="crm.menu_crm_config_lead" />
</data>
</odoo>