Skip to content

[16.0][ADD] kris_project: revenue tracking module#554

Open
n3n wants to merge 27 commits into16.0from
16.0-add-kris_project
Open

[16.0][ADD] kris_project: revenue tracking module#554
n3n wants to merge 27 commits into16.0from
16.0-add-kris_project

Conversation

@n3n
Copy link
Copy Markdown
Member

@n3n n3n commented Mar 2, 2026

Summary

New KRIS Project module for tracking post-contract academic service and research project revenue. Provides complete lifecycle management from project setup through revenue allocation.

Features

  • Auto-sequenced project IDs (KRIS/2568/0001 format)
  • Contract installment tracking with amount and due date management
  • Revenue receipt recording with optional installment linkage
  • Automated 4-way allocation breakdown (central 35%, faculty 35%, department 20%, KRIS 10%)
  • Simple state machine: draft → confirmed → done, with cancel/reset options
  • Computed totals: installments, received amounts, remaining revenue
  • 3-tier security: User (own records), Officer (all records), Manager (full access)
  • Thai language UI with comprehensive form, tree, and search views

Testing

Install module and verify: project creation with all fields, installment/receipt management, allocation computation, state transitions, security rules.

@n3n n3n force-pushed the 16.0-add-kris_project branch from b6d2dcf to c6983da Compare March 10, 2026 09:10
@n3n n3n force-pushed the 16.0-add-kris_project branch from 2d8e108 to 45ef2ab Compare March 30, 2026 16:03
n3n and others added 22 commits April 17, 2026 11:45
…h projects

Implement new KRIS Project module for tracking post-contract academic service and research project revenue. Includes installment management, receipt recording, and automated allocation breakdown across 4 recipients (central, faculty, department, KRIS).

Features: simple state machine (draft → confirmed → done/cancel), auto-generated project sequences, computed financial totals, and 3-tier security groups.
…vice & research projects

Add comprehensive revenue tracking and allocation system for KRIS academic service and research projects. Key changes:

- Created kris.project.type master data model with 2 categories (academic_service, research) and 6 default types
- Refactored project_type from Selection to Many2one relation with kris.project.type
- Changed project leader from free-text leader_name to leader_id Many2one to hr.employee
- Added maintenance_deduction_amount computed field (allocatable_value × pct / 100)
- Redesigned Tab 1 (มูลค่าและงวดงาน) with reorganized financial field layout
- Enhanced Tab 2 (รายรับ) with auto-fill receipt amount from selected installment via onchange
- Refactored Tab 3 (การจัดสรรรายได้):
  - estimated_amount now editable (stored) instead of computed
  - allocation_pct computed from estimated_amount / maintenance_deduction_amount × 100
  - Users can now customize allocation percentages after initial computation
- Added Tab 4 (เอกสารแนบ) for document attachments using chatter widget
- Updated allocation line computation: estimated_amount auto-filled from 35-35-20-10 split, then user-editable
- Added Configuration menu with Project Type CRUD for managers
- Added kris.project.type model access control (managers full CRUD, users read-only)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
…pe models

Split the single kris.project.type model (with category Selection field) into
two separate models:

- kris.project.category: parent model (งานบริการวิชาการ, งานวิจัย)
- kris.project.type: sub-type model linked to category via Many2one

On the project form, users first select a category, then select a sub-type
filtered by that category. Onchange clears the sub-type when category changes.

Updated seed data, security access, views, and menus accordingly.
…rovements

- Replace inline receipt entry with a wizard (kris.project.receipt.wizard)
  - auto-fills project, filters out already-used installments
  - shows ยอดรับสุทธิ = จำนวนเงิน - มูลค่าครุภัณฑ์ in real time
- Add equipment_cost_in_installment and net_amount to receipt model
- Add total_net_received computed total on project
- Fix actual_amount formula: (total_net_received × %หักค่าบำรุง) × %จัดสรร
- Add @constrains: sum of allocation_pct must not exceed 100%
- Add sum footer for % จัดสรร column in allocation tree
- Replace placeholder attachment div with many2many_binary field
Add a dashboard client action to the KRIS Project app showing:
- Summary cards: total project value, total received, KRIS estimated/actual
- Horizontal bar chart: KRIS revenue by project sub-type
- Horizontal bar chart: Top 10 project leaders by receipts received
- Combo chart: monthly receipts current year (bar) vs previous year (line)
- Heatmap: allocation actual amounts by faculty × recipient type

Filters: date range (receipt date), category, cascaded sub-type, fiscal year.
Dashboard menu appears first (sequence=1) in the KRIS Project app.
…ceipts

1. Maintenance deduction type: add selection field (ขั้นบันได / กำหนดเอง).
   - ขั้นบันได: progressive tiers 10%/9%/8%/7% on allocatable_value.
   - กำหนดเอง: flat percentage (existing behaviour).
   - Allocation actual_amount now uses effective_rate (maintenance_deduction_amount
     / allocatable_value) so it works correctly for both modes.

2. Receipt "ปันส่วนไป KRIS" flag: add allocate_to_kris boolean (default True)
   to kris.project.receipt and the wizard. KRIS allocation line uses only the
   net_amount from receipts where allocate_to_kris=True; all other lines use
   total_net_received as before.

3. Delete receipts: remove readonly="1" from receipt_ids O2M in the form view
   and add create="0" on the tree so users can delete rows but not add inline.
   Fully readonly when project state is done or cancel.
…eceipt allocation breakdown

- Add allocation item & template master data models with seed data
  (ส่วนกลาง/คณะ/ภาค/KRIS, 35/35/20/10 standard template)
- Add per-installment and per-receipt allocation breakdown models
- operating_expense: onchange auto-suggests project_value - equipment_cost
- allocatable_value now equals operating_expense (split compute methods)
- Replace action_compute_allocation with action_apply_allocation_template
- Add installment wizard (replaces inline editable tree)
- Receipt wizard: add allocation breakdown, default from installment
- actual_amount simplified to sum of receipt allocation amounts
- Remove allocate_to_kris field (replaced by per-receipt allocation lines)
- Add security rules and access rights for all new models
Add allocation_line_id as column_invisible in installment and receipt
wizard trees so the OWL client includes it when saving. Also add
create="0" delete="0" to prevent adding rows without the required field.
…ient

In Odoo 16, fields with readonly=True on the model are not sent by the
OWL client during create. Remove readonly from wizard line models and
enforce it view-side instead.
Add deduction_guarantee, deduction_advance, received_from_employer,
maintenance_fee, extra_deduction, and amount_net fields to
kris.project.installment. Update form and tree views accordingly.
Remove kris.project.installment.wizard and its line model. Move the
pre-populate allocation logic and auto-sequence assignment into
kris.project.installment itself via default_get and create overrides.

Add estimated_amount, allocated_amount, remaining_amount display fields
to kris.project.installment.allocation with a single read_group query
(fixes N+1). Excludes current installment in edit mode to avoid
double-counting (correctness fix).

The installment form is now used for both create and edit, with the
allocation tree showing full info columns identical to the old wizard.
…oject duration

Add base.exception integration for state transition warnings:
- 5 confirm-phase rules (project value, allocation, installments)
- 2 done-phase rules (installments received, revenue collected)
- 1 cancel-phase rule (receipts exist)
All rules are non-blocking and ignorable via confirmation wizard.

Change project_duration from free-text Char to computed Integer (days),
auto-calculated from contract start/end dates.
…gle field

Remove faculty_id, keep only department_id (renamed to "หน่วยงาน").
Update form, tree, search views and dashboard heatmap accordingly.
@madara1150 madara1150 force-pushed the 16.0-add-kris_project branch from 96872c1 to e8e391f Compare April 17, 2026 04:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants