odoo18/addons_extensions/weekly_timesheets/views/weekly_period_timesheets.xml

154 lines
7.3 KiB
XML

<odoo>
<record id="view_weekly_period_timesheets_form" model="ir.ui.view">
<field name="name">weekly.periodtimesheets.form</field>
<field name="model">weekly.periodtimesheets</field>
<field name="arch" type="xml">
<form string="Weekly Period Timesheets">
<header>
<button name="action_submit"
string="Submit"
type="object"
class="btn-primary"
invisible="state != 'draft'"/>
<button name="action_reject"
string="Reject"
type="object"
class="btn-primary"
invisible="state != 'submitted' or not can_current_user_approve_weekly"/>
<button name="action_approve"
string="Approve"
type="object"
class="btn-primary"
invisible="state != 'submitted' or not all_pm_approved or not can_current_user_approve_weekly"/>
<button name="action_reset_to_draft"
string="Reset to Draft"
type="object"
class="btn-primary"
invisible="state != 'rejected'"/>
<button name="action_refresh_timesheets"
string="Refresh"
type="object"
class="btn-secondary"
invisible="context.get('weekly_timesheet_approval') or not can_current_user_refresh_weekly"/>
<field name="state"
widget="statusbar"/>
<field name="all_pm_approved" invisible="1"/>
<field name="can_current_user_approve_weekly" invisible="1"/>
<field name="can_current_user_refresh_weekly" invisible="1"/>
</header>
<sheet>
<group>
<field name="employee_id"
readonly="1"
domain="[('user_id', '=', uid)]"
options="{'no_open': True, 'no_create': True}"/>
<field name="year_id"
readonly="state in ('submitted','approved')"/>
<field name="week_line_id"
readonly="state in ('submitted','approved')"/>
<field name="total_hours"
readonly="1"/>
</group>
<notebook>
<page string="Weekly Timesheets Summary">
<field name="timesheet_line_ids"
readonly="state in ('submitted','approved')">
<list create="0"
edit="0"
delete="0">
<field name="date"/>
<field name="day_name"/>
<field name="hours"/>
</list>
</field>
</page>
<page string="Daily Timesheets">
<field name="analytic_line_ids">
<list editable="bottom">
<field name="date"/>
<field name="employee_id"/>
<field name="name"/>
<field name="project_id"/>
<field name="task_id"/>
<field name="task_stage_id" string="Stage"/>
<field name="unit_amount" string="Time Spent"/>
<field name="approval_state"/>
<field name="weekly_submitted" column_invisible="1"/>
<field name="can_current_user_approve_line" column_invisible="1"/>
<button name="action_pm_approve"
string="Approve"
type="object"
class="btn-success"
invisible="approval_state == 'approved' or not project_id or not weekly_submitted or not can_current_user_approve_line"/>
<button name="action_pm_reject"
string="Reject"
type="object"
class="btn-danger"
invisible="approval_state == 'rejected' or not project_id or not weekly_submitted or not can_current_user_approve_line"/>
</list>
</field>
</page>
</notebook>
<group class="oe_subtotal_footer oe_right">
<field name="total_hours" readonly="1"/>
</group>
</sheet>
</form>
</field>
</record>
<record id="view_weekly_period_timesheets_list" model="ir.ui.view">
<field name="name">weekly.periodtimesheets.list</field>
<field name="model">weekly.periodtimesheets</field>
<field name="arch" type="xml">
<list string="Weekly Period Timesheets">
<field name="employee_id"/>
<field name="year_id"/>
<field name="week_line_id"/>
<field name="total_hours"/>
<field name="state"/>
</list>
</field>
</record>
<record id="action_weekly_period_timesheets" model="ir.actions.act_window">
<field name="res_model">weekly.periodtimesheets</field>
<field name="view_mode">list,form</field>
<field name="domain">[('employee_id.user_id', '=', uid)]</field>
<field name="context">{'weekly_timesheet_approval': 0}</field>
<field name="view_ids"
eval="[(5, 0, 0),
(0, 0, {'view_mode': 'list', 'view_id': ref('view_weekly_period_timesheets_list')}),
(0, 0, {'view_mode': 'form', 'view_id': ref('view_weekly_period_timesheets_form')})]"/>
</record>
<record id="action_weekly_timesheet_approval" model="ir.actions.act_window">
<field name="name">Weekly Timesheet Approval</field>
<field name="res_model">weekly.periodtimesheets</field>
<field name="view_mode">list,form</field>
<field name="domain">[
('state', '=', 'submitted'),
('can_current_user_approve_weekly', '=', True)
]</field>
<field name="context">{'weekly_timesheet_approval': 1}</field>
<field name="view_ids"
eval="[(5, 0, 0),
(0, 0, {'view_mode': 'list', 'view_id': ref('view_weekly_period_timesheets_list')}),
(0, 0, {'view_mode': 'form', 'view_id': ref('view_weekly_period_timesheets_form')})]"/>
</record>
</odoo>