<?xml version="1.0"?>
<form string="Challenge">
                <header>
                    <button string="Start Challenge" type="object" name="action_start" states="draft" class="oe_highlight"/>
                    <button string="Refresh Challenge" type="object" name="action_check" states="inprogress"/>
                    <button string="Send Report" type="object" name="action_report_progress" states="inprogress,done" groups="base.group_no_one"/>
                    <field name="state" widget="statusbar" options="{'clickable': '1'}"/>
                </header>
                <sheet>
                    <!-- action buttons -->
                    <div class="oe_button_box" name="button_box">
                        <button type="object" name="action_view_users" class="oe_stat_button" icon="fa-users">
                            <field name="user_count" string="Participants" widget="statinfo"/>
                        </button>
                        <button type="action" name="322" class="oe_stat_button" icon="fa-gift" attrs="{'invisible': [('state','=','draft')]}">
                            <div class="o_field_widget o_stat_info">
                                <span class="o_stat_text">Related</span>
                                <span class="o_stat_text">Goals</span>
                            </div>
                        </button>
                    </div>
                    <div class="oe_title">
                        <label for="name"/>
                        <h1>
                            <field name="name" placeholder="e.g. Monthly Sales Objectives"/>
                        </h1>
                        <label for="user_domain" string="Assign Challenge to"/>
                        <div>
                            <field name="user_domain" widget="domain" options="{'model': 'res.users'}"/>
                        </div>
                    </div>
                    <group>
                        <group>
                            <field name="period" attrs="{'readonly':[('state','!=','draft')]}"/>
                            <field name="visibility_mode" widget="radio" colspan="1"/>
                        </group>
                        <group>
                            <field name="manager_id"/>
                            <field name="start_date" attrs="{'readonly':[('state','!=','draft')]}"/>
                            <field name="end_date" attrs="{'readonly':[('state','!=','draft')]}"/>
                        </group>
                    </group>
                    <notebook>
                        <page string="Goals" name="goals">
                            <field name="line_ids" nolabel="1" colspan="4">
                                <tree string="Line List" editable="bottom">
                                    <field name="sequence" widget="handle"/>
                                    <field name="definition_id"/>
                                    <field name="condition"/>
                                    <field name="target_goal" string="Target"/>
                                    <field name="definition_full_suffix"/>
                                </tree>
                            </field>
                            <field name="description" placeholder="Describe the challenge: what is does, who it targets, why it matters..."/>
                        </page>
                        <page string="Reward" name="reward">
                            <group>
                                <field name="reward_id" attrs="{'required': [('reward_realtime','=', True)]}"/>
                                <field name="reward_first_id"/>
                                <field name="reward_second_id" attrs="{'invisible': [('reward_first_id','=', False)]}"/>
                                <field name="reward_third_id" attrs="{'invisible': ['|',('reward_first_id','=', False),('reward_second_id','=', False)]}"/>
                                <field name="reward_failure" attrs="{'invisible': [('reward_first_id','=', False)]}"/>
                                <field name="reward_realtime"/>
                            </group>
                            <div class="oe_grey">
                                <p>Badges are granted when a challenge is finished. This is either at the end of a running period (eg: end of the month for a monthly challenge), at the end date of a challenge (if no periodicity is set) or when the challenge is manually closed.</p>
                            </div>
                        </page>
                        <page string="Advanced Options" name="advanced_options">
                            <group string="Subscriptions">
                                <field name="invited_user_ids" widget="many2many_tags"/>
                            </group>
                            <group string="Notification Messages">
                                <div class="oe_grey" colspan="4">
                                    <p>Depending on the Display mode, reports will be individual or shared.</p>
                                </div>
                                <group colspan="4">
                                    <field name="report_message_frequency"/>
                                    <field name="report_template_id" attrs="{'invisible': [('report_message_frequency','=','never')]}"/>
                                    <field name="report_message_group_id" attrs="{'invisible': [('report_message_frequency','=','never')]}"/>
                                </group>
                            </group>
                            <group string="Reminders for Manual Goals">
                                <label for="remind_update_delay"/>
                                <div>
                                    <field name="remind_update_delay" class="oe_inline"/> days
                                </div>
                            </group>
                            <group string="Category" groups="base.group_no_one">
                                <field name="challenge_category" widget="radio"/>
                            </group>
                        </page>
                    </notebook>

                </sheet>
                <div class="oe_chatter">
                    <field name="message_follower_ids"/>
                    <field name="message_ids"/>
                </div>
            </form>
        