summaryrefslogtreecommitdiff
path: root/addons/base_automation/views/base_automation_view.xml
blob: 5bce06082f5abb4bc3e6a38b346224a07cec3179 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?xml version="1.0" encoding="utf-8"?>
<odoo>

        <!-- Automation Form View -->
        <record id="view_base_automation_form" model="ir.ui.view">
            <field name="name">Automations</field>
            <field name="model">base.automation</field>
            <field name="mode">primary</field>
            <field name="inherit_id" ref="base.view_server_action_form"/>
            <field name="arch" type="xml">
                <xpath expr="//button[@name='create_action']" position="replace">
                </xpath>
                <xpath expr="//button[@name='unlink_action']" position="replace">
                </xpath>
                <xpath expr="//button[@name='run']" position="replace">
                </xpath>
                <xpath expr="//field[@name='partner_ids']" position='attributes'>
                    <attribute name="options">{'no_create': True}</attribute>
                </xpath>
                <xpath expr="//field[@name='channel_ids']" position='attributes'>
                    <attribute name="options">{'no_create': True}</attribute>
                </xpath>
                <xpath expr="//field[@name='template_id']" position='attributes'>
                    <attribute name="context">{'default_model_id': model_id}</attribute>
                </xpath>
                <xpath expr="//page[@name='security']" position='attributes'>
                    <attribute name='invisible'>1</attribute>
                </xpath>
                <xpath expr="//group[@name='action_content']" position="inside">
                    <field name="active" widget="boolean_toggle"/>
                    <field name="trigger"/>
                    <field name="trigger_field_ids" domain="[('model_id', '=', model_id)]" attrs="{'invisible': [('trigger', 'not in', ['on_write', 'on_create_or_write'])]}" widget="many2many_tags"/>
                    <field name="on_change_field_ids" string="Trigger Fields" domain="[('model_id', '=', model_id)]"
                        attrs="{'invisible': [('trigger', '!=', 'on_change')], 'required': [('trigger', '=', 'on_change')]}"
                        widget='many2many_tags' options="{'no_create': True}"/>

                    <field name="filter_pre_domain" widget="domain" options="{'model': 'model_name', 'in_dialog': True}" attrs="{'invisible': [('trigger', 'not in', ['on_write','on_create_or_write'])]}"/>
                    <field name="filter_domain" widget="domain" options="{'model': 'model_name', 'in_dialog': True}"/>
                    <field name="trg_date_id"
                        attrs="{'invisible': [('trigger', '!=', 'on_time')], 'required': [('trigger', '=', 'on_time')]}"/>
                    <label for="trg_date_range"
                        attrs="{'invisible': [('trigger', '!=', 'on_time')]}"/>
                    <div class="o_row" attrs="{'invisible': [('trigger', '!=', 'on_time')]}">
                        <field name="trg_date_range" attrs="{'required': [('trigger','=','on_time')]}"/>
                        <field name="trg_date_range_type" attrs="{'required': [('trigger','=','on_time')]}"/>
                    </div>
                    <field name="trg_date_calendar_id"
                        attrs="{'invisible': ['|', ('trg_date_id','=',False), ('trg_date_range_type', '!=', 'day')]}"/>
                </xpath>
                <xpath expr="//group[@name='action_wrapper']" position="after">
                    <div class="alert alert-info" role="alert" attrs="{'invisible': [('trigger', '!=', 'on_time')]}">
                        <field name="least_delay_msg"/>
                    </div>
                </xpath>
            </field>
        </record>

        <!-- automation Tree View -->
        <record id="view_base_automation_tree" model="ir.ui.view">
            <field name="name">base.automation.tree</field>
            <field name="model">base.automation</field>
            <field name="arch" type="xml">
                <tree string="Automation">
                    <field name="sequence" widget="handle"/>
                    <field name="name"/>
                    <field name="trigger"/>
                    <field name="model_id"/>
                </tree>
            </field>
        </record>

        <record id="view_base_automation_search" model="ir.ui.view">
            <field name="name">base.automation.search</field>
            <field name="model">base.automation</field>
            <field name="arch" type="xml">
                <search>
                    <field name="name"/>
                    <field name="model_id"/>
                    <separator/>
                    <filter string="Archived" name="inactive" domain="[('active', '=', False)]"/>
                </search>
            </field>
        </record>

        <!-- automation Action -->
        <record id="base_automation_act" model="ir.actions.act_window">
            <field name="name">Automated Actions</field>
            <field name="res_model">base.automation</field>
            <field name="view_mode">tree,form</field>
            <field name="view_id" ref="view_base_automation_tree"/>
            <field name="help" type="html">
              <p class="o_view_nocontent_smiling_face">
                Setup a new automated automation
              </p><p>
                Use automated actions to automatically trigger actions for
                various screens. Example: a lead created by a specific user may
                be automatically set to a specific Sales Team, or an
                opportunity which still has status pending after 14 days might
                trigger an automatic reminder email.
              </p>
            </field>
        </record>

        <menuitem id="menu_base_automation_form"
            parent="base.menu_automation" action="base_automation_act" sequence="1"/>

        <template id="assets_backend" name="base_automation assets" inherit_id="web.assets_backend">
            <xpath expr="." position="inside">
                <script type="text/javascript" src="/base_automation/static/src/js/base_automation_error_dialog.js"/>
            </xpath>
        </template>

        <template id="qunit_suite" name="base_automation_tests" inherit_id="web.qunit_suite_tests">
            <xpath expr="." position="inside">
                <script type="text/javascript" src="/base_automation/static/tests/base_automation_error_dialog.js"/>
            </xpath>
        </template>

</odoo>