Add timesheet / AI-audit time tracking (wraps account.analytic.line)
- fl.timesheet via delegation inheritance on account.analytic.line so billable hours flow through standard Odoo Accounting; duration_hours maps to unit_amount - Fields: case_id, employee_id, is_billable, ai_agent, duration_hours, computed hourly_rate/billable_amount (rate from hr.employee.fl_hourly_rate, else firm default ir.config_parameter fl_timesheet.default_hourly_rate) - _resolve_analytic_account: prefers the case project's analytic account (version-agnostic field lookup), falls back to a cached firm account under any available analytic plan — handles the required account_id on the wrapped line - Add 'analytic' to manifest depends; ACL for fl.timesheet and account.analytic.line (admin + paralegal) so non-admins can post entries - fl.case: timesheet_ids + total_billable_hours/amount + total_ai_audit_hours + currency_id; new Time & Billing tab; Timesheets menu + standalone views - Both AI agents now log non-billable audit entries via sudo() (paralegal + attorney, ai_agent set); logging stays a guarded no-op if creation fails Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -310,6 +310,34 @@
|
||||
<field name="total_expenses" readonly="1"/>
|
||||
</page>
|
||||
|
||||
<!-- TAB 9: Time & Billing -->
|
||||
<page string="Time & Billing" name="timesheets">
|
||||
<group>
|
||||
<group>
|
||||
<field name="total_billable_hours" readonly="1"/>
|
||||
<field name="total_billable_amount" readonly="1"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="total_ai_audit_hours" readonly="1"/>
|
||||
<field name="currency_id" invisible="1"/>
|
||||
</group>
|
||||
</group>
|
||||
<field name="timesheet_ids">
|
||||
<tree string="Timesheet Entries" editable="bottom"
|
||||
decoration-muted="is_billable == False">
|
||||
<field name="date"/>
|
||||
<field name="name"/>
|
||||
<field name="employee_id"/>
|
||||
<field name="duration_hours" sum="Hours"/>
|
||||
<field name="is_billable"/>
|
||||
<field name="ai_agent" readonly="1"/>
|
||||
<field name="hourly_rate" readonly="1"/>
|
||||
<field name="billable_amount" readonly="1" sum="Amount"/>
|
||||
<field name="currency_id" column_invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
|
||||
</notebook>
|
||||
</sheet>
|
||||
<div class="oe_chatter">
|
||||
|
||||
84
activeblue_familylaw/views/fl_timesheet_views.xml
Normal file
84
activeblue_familylaw/views/fl_timesheet_views.xml
Normal file
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<record id="view_fl_timesheet_tree" model="ir.ui.view">
|
||||
<field name="name">fl.timesheet.tree</field>
|
||||
<field name="model">fl.timesheet</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Timesheet Entries" editable="bottom"
|
||||
decoration-muted="is_billable == False">
|
||||
<field name="date"/>
|
||||
<field name="case_id"/>
|
||||
<field name="name"/>
|
||||
<field name="employee_id"/>
|
||||
<field name="duration_hours" sum="Hours"/>
|
||||
<field name="is_billable"/>
|
||||
<field name="ai_agent" readonly="1"/>
|
||||
<field name="hourly_rate" readonly="1"/>
|
||||
<field name="billable_amount" readonly="1" sum="Amount"/>
|
||||
<field name="currency_id" column_invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_fl_timesheet_form" model="ir.ui.view">
|
||||
<field name="name">fl.timesheet.form</field>
|
||||
<field name="model">fl.timesheet</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Timesheet Entry">
|
||||
<sheet>
|
||||
<group>
|
||||
<group>
|
||||
<field name="case_id"/>
|
||||
<field name="employee_id"/>
|
||||
<field name="date"/>
|
||||
<field name="name"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="duration_hours"/>
|
||||
<field name="is_billable"/>
|
||||
<field name="ai_agent" readonly="1"/>
|
||||
<field name="hourly_rate" readonly="1"/>
|
||||
<field name="billable_amount" readonly="1"/>
|
||||
<field name="currency_id" invisible="1"/>
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_fl_timesheet_search" model="ir.ui.view">
|
||||
<field name="name">fl.timesheet.search</field>
|
||||
<field name="model">fl.timesheet</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Timesheets">
|
||||
<field name="case_id"/>
|
||||
<field name="employee_id"/>
|
||||
<filter string="Billable" name="billable"
|
||||
domain="[('is_billable', '=', True)]"/>
|
||||
<filter string="AI Audit" name="ai_audit"
|
||||
domain="[('ai_agent', '!=', False)]"/>
|
||||
<group expand="0" string="Group By">
|
||||
<filter string="Case" name="group_case"
|
||||
context="{'group_by': 'case_id'}"/>
|
||||
<filter string="Employee" name="group_employee"
|
||||
context="{'group_by': 'employee_id'}"/>
|
||||
<filter string="AI Agent" name="group_ai"
|
||||
context="{'group_by': 'ai_agent'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_fl_timesheet_list" model="ir.actions.act_window">
|
||||
<field name="name">Timesheets</field>
|
||||
<field name="res_model">fl.timesheet</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="search_view_id" ref="view_fl_timesheet_search"/>
|
||||
<field name="context">{'search_default_billable': 1}</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -94,6 +94,13 @@
|
||||
action="action_fl_conflict_check_list"
|
||||
sequence="70"/>
|
||||
|
||||
<menuitem
|
||||
id="menu_fl_timesheets"
|
||||
name="Timesheets"
|
||||
parent="menu_fl_cases"
|
||||
action="action_fl_timesheet_list"
|
||||
sequence="80"/>
|
||||
|
||||
<!-- ══════════════════════════════════════════════════════
|
||||
SUPPORT CALCULATOR SUB-MENU
|
||||
══════════════════════════════════════════════════════ -->
|
||||
|
||||
Reference in New Issue
Block a user