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:
2026-05-29 00:26:00 +00:00
parent 465c049251
commit 70c951a7ef
10 changed files with 315 additions and 1 deletions

View File

@@ -310,6 +310,34 @@
<field name="total_expenses" readonly="1"/>
</page>
<!-- TAB 9: Time & Billing -->
<page string="Time &amp; 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">