[19.0][ADD] hr_expense_trip#352
Conversation
f8b7495 to
e2db90e
Compare
41c7841 to
97e216a
Compare
97e216a to
4f26c90
Compare
|
@dnplkndll I am still continuing on the other PR. Feel free to make suggestions or pull requests when you have improvements. I "paused" to to collect feedback and because of other work, but I will continue soon. I think most (all) of your changes are by AI? Also not clear to me why to delete the readme folder? |
|
@CRogos closing this. not sure why this got posted is just the same work. I was interested in using this as a dependency. In the past I was involved in some back card transaction sync modules and have just submitted the ramp and mercury api implementation, OCA/bank-statement-import#950 OCA/bank-statement-import#952 once you associate the transactions to employees with the last 4, then you would want to assosiate to a PO or maybe an expense report trip so that all the trip tags might apply. i will have to workshop this again now. I can see why the change in core is it was clumsy I though for end users. and perhaps some agent wil take care of it in the future. but for now trips to budgest and approvals still seems like the right path. |
Adds the new module
hr_expense_tripon 19.0.Origin: continuation of #337 by @CRogos, which marked the work as
[19.0][WIP][ADD]and stopped short of a working 19.0 implementation. CRogos is credited via theCo-authored-by:trailer on the squash commit and listed inreadme/CONTRIBUTORS.md. If/when this lands, #337 can be closed as superseded. The module does not exist on any earlier OCA series (verified 14.0–18.0 absent), so the prefix is[ADD]and not[MIG].What it does
A trip is a date-bounded container that groups any number of
hr.expenserecords belonging to the same employee. The trip carries a name, reason, partner, employee, start/end date, and a state machine (Draft → Requested → Collect Receipts → Done) with optional auto-approval via thehr_expense_trip.auto_approvesystem parameter. When the trip transitions to Done, a per-trip PDF report is rendered and posted to the trip's chatter as an attachment.On the expense form, a
Tripfield lets the user link an expense to a matching trip;default_getpre-selects the matching open trip when the expense date falls inside it.Non-mechanical adaptations worth flagging
hr.expense.sheet. The trip plays the same "container for many expenses" role but with an independent approval state and an independent PDF report. The link ishr.expense.trip_idMany2one withondelete="set null"so detaching the trip doesn't cascade-delete expenses.ir.actions.report._render_qweb_pdf(report_ref, res_ids)signature — the 18.0 record-boundreport._render_qweb_pdf(res_ids)shape is gone._attach_trip_reportwas updated accordingly.expense_lines_widgetESM widget keeps only theisMany2Many=trueoverride so the user can add existing expenses via the standard m2m selector. The 18.0-era attachment-thread switching and FileViewer integration were tied tohr.expense.sheet(now removed) and have been dropped.static/src/views/list.xml(a verbatim copy of 18.0 core's sheet-mode list template) was deleted — the module's manifest asset glob is*.jsonly, so the file was never loaded, and every method it referenced (displayCreateReport,displaySubmit, …) is dead on 19.0.action_done → _attach_trip_report → PDF attach via message_post. The previouspatch.object(_attach_trip_report)mock was removed — that mock was hiding the broken render signature from CI.Test coverage
tests/test_hr_trip.py— 12 test methods covering: trip creation defaults, employee default, date-range constraint (valid + invalid + start-after-end),trip_idcleared on parent unlink, "My Trips" search-domain filter, mail.thread mixin, full state-machine transitions (with real PDF render),auto_approveenabled vs disabled, anddefault_gettrip pre-selection on the expense form (matching + non-matching cases).