Community mailing list archives

Dynamic relation for 2 unrelated models

Andre Kurniawan
- 08/10/2015 03:15:01
Dear Community,

I have 2 models:
  1. Schedule(myhr.schedule)
  • dt_in (Datetime)
  • dt_out (Datetime)
  • Attendance data (
    • dt_check (Datetime)

    I want to create a dynamic One2many relation from Schedule to Attendance data. For the relation, the Attendance data's dt_check must be inside the range of Schedule's dt_in and dt_out. Schedule and Attendance data can be edited by user (a HR manager).

    The problem is that a Schedule can be created ahead of its Attendance data, and vice versa, so I can't exactly use computational field since each model can trigger each other. Anyone has solution for this?