Skip to content
Snippets Groups Projects
hr_timesheet_cgscop.xml 7.85 KiB
Newer Older
  • Learn to ignore specific revisions
  • Benjamin's avatar
    Benjamin committed
    <?xml version="1.0"?>
    <!-- Copyright 2019 Le Filament
         License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
    
    <odoo>
        <data>
            
            <!-- Form View Project CG -->
            <record id="view_cgscop_project_timesheet_form" model="ir.ui.view">
                <field name="name">cgscop.project.timesheet.form</field>
                <field name="model">project.project</field>
                <field name="arch" type="xml">
                    <form string="Project">
                        <sheet string="Project">
                            <div class="oe_button_box" name="button_box" groups="base.group_user">
                                <button class="oe_stat_button" name="%(hr_timesheet.act_hr_timesheet_line_by_project)d" type="action" icon="fa-calendar" string="Timesheets" attrs="{'invisible': [('allow_timesheets', '=', False)]}" groups="hr_timesheet.group_hr_timesheet_user"/>
                                <button name="toggle_active" type="object"
                                        confirm="(Un)archiving a project automatically (un)archives its tasks. Do you want to proceed?"
                                        class="oe_stat_button" icon="fa-archive">
                                    <field name="active" widget="boolean_button"
                                        options='{"terminology": "archive"}'/>
                                </button>
                            </div>
                            <div class="oe_title">
                                <h1>
                                    <field name="name" placeholder="Code activité UR"/>
                                </h1>
                            </div>
                            <group>
                                <group>
                                    <field name="partner_id" string="Contact par défaut" help="Contact par défaut auquel est rattaché cette activité. Ce contact sera sélectionné automatiquement dans les feuilles de temps"/>
                                    <field name="company_id" groups="base.group_multi_company" string="UR" />
                                </group>
                                <group>
                                    <field name="cgscop_timesheet_code_id" required="1" placeholder="Code activité CG"/>
                                    <field name="privacy_visibility" invisible="1"/>
                                    <field name="allow_timesheets" invisible="1"/>
                                </group>
                            </group>
                        </sheet>
                        <div class="oe_chatter">
                            <field name="message_follower_ids" widget="mail_followers" help="Follow this project to automatically track the events associated to tasks and issues of this project." groups="base.group_user"/>
                        </div>
                    </form>
                </field>
            </record>
    
            <!-- Search View Project CG -->
            <record id="view_cgscop_project_timesheet_filter" model="ir.ui.view">
                <field name="name">cgscop.project.timesheet.search</field>
                <field name="model">project.project</field>
                <field name="arch" type="xml">
                    <search string="Search Project">
                        <field name="name" string="Code activité UR"/>
                        <field name="cgscop_timesheet_code_id" string="Code activité CG"/>
                        <field name="partner_id" string="Contact par défaut"/>
    
                        <filter string="Archived" name="inactive" domain="[('active','=',False)]"/>
    
                        <group expand="0" string="Group By">
                            <filter string="Contact par défaut" name="Partner" context="{'group_by': 'partner_id'}"/>
                        </group>
                    </search>
                </field>
            </record>
    
            <!-- Tree View Project CG -->
            <record id="view_cgscop_project_timesheet_tree" model="ir.ui.view">
                <field name="name">cgscop.project.timesheet.tree</field>
                <field name="model">project.project</field>
                <field name="arch" type="xml">
                    <tree decoration-muted="active == False" string="Projects">
                        <field name="sequence" widget="handle"/>
                        <field name="active" invisible="1"/>
                        <field name="name" />
                        <field name="cgscop_timesheet_code_id" />
                        <field name="partner_id" string="Contact"/>
                    </tree>
                </field>
            </record>
    
            <!-- Kanban View Project CG -->
            <record id="view_cgscop_project_timesheet_kanban" model="ir.ui.view">
                <field name="name">cgscop.project.timesheet.kanban</field>
                <field name="model">project.project</field>
                <field name="arch" type="xml">
                    <kanban class="o_kanban_mobile">
                        <field name="user_id" string="Project Manager"/>
                        <templates>
                            <t t-name="kanban-box">
                                <div t-attf-class="oe_kanban_content oe_kanban_global_click o_kanban_get_form">
                                    <div class="row">
                                        <div class="col-12">
                                            <strong><field name="name" string="Code activité UR"/></strong>
                                            <field name="cgscop_timesheet_code_id" string="Code activité CG"/>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-8">
                                            <field name="partner_id" string="Contact"/>
                                        </div>
                                        <div class="col-4">
                                            <div class="oe_kanban_bottom_right">
                                                <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="24" height="24" class="oe_kanban_avatar float-right"/>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </t>
                        </templates>
                    </kanban>
                </field>
            </record>
    
            <record id="act_cgscop_project_timesheet" model="ir.actions.act_window">
                <field name="name">Codes activités UR</field>
                <field name="res_model">project.project</field>
                <field name="view_type">form</field>
                <field name="domain">[]</field>
                <field name="view_mode">tree,kanban,form</field>
                <field name="view_ids" eval="[(5, 0, 0),
                    (0, 0, {'view_mode': 'tree', 'view_id': ref('view_cgscop_project_timesheet_tree')}),
                    (0, 0, {'view_mode': 'kanban', 'view_id': ref('view_cgscop_project_timesheet_kanban')}),
                    (0, 0, {'view_mode': 'form', 'view_id': ref('view_cgscop_project_timesheet_form')})]"/>
                <field name="search_view_id" ref="view_cgscop_project_timesheet_filter"/>
                <field name="context">{
                    'default_privacy_visibility': 'employees',
                    'default_allow_timesheets': True,
                }</field>
                <field name="help" type="html">
                    <p class="o_view_nocontent_empty_folder">
                        Create a new project
                    </p><p>
                        Organize your activities (plan tasks, track issues, invoice timesheets) for internal, personal or customer projects.
                    </p>
                </field>
            </record>
    
            <menuitem
                name="Codes Activité UR"
                parent="hr_timesheet.hr_timesheet_menu_configuration"
                action="act_cgscop_project_timesheet"
                id="menu_action_project_lines_tree"
                sequence="35"
                groups="analytic.group_analytic_accounting"/>
    
        </data>
    </odoo>