Skip to content

[16.0][FIX] ni_observation: compute each observation's own history - #185

Merged
piruin merged 1 commit into
nirun-life:16.0from
wasud:16.0-fix-observation-history
Oct 30, 2026
Merged

piruin merged 1 commit into
nirun-life:16.0from
wasud:16.0-fix-observation-history

Conversation

@wasud

@wasud wasud commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Refs #181 · Found by CI on #183 · Forward-ported in #182 (17.0), #183 (18.0), #184 (19.0)

Summary (TH)

แก้ _compute_history ของ ni.observation ที่ใช้ self แทน rec ใน loop เวลาอ่าน history ของหลาย observation พร้อมกัน (เช่น list ของ latest observation หรือ export) ทุกแถวจะได้ history ของทุก type ปนกัน และ domain ใช้ = กับ list ซึ่ง Odoo 17 ขึ้นไปจะขึ้น warning จน CI fail (เจอบน #183)

Changes

Module Fix Version
ni_observation _compute_history uses rec.patient_id and ("type_id", "in", rec.type_id.get_display_type().ids); new tests/test_observation_history.py 16.0.0.6.3

How tested

  • Fresh 16.0 DB with demo, -i ni_observation --test-tags /ni_observation: 0 failed, 0 errors of 34 tests.
  • On 18.0, the new test fails without the fix (ni.observation(163, 164, 162) != ni.observation(163, 162)) and passes with it.
  • pre-commit clean on the changed files.

_compute_history searched with self.patient_id and self.type_id inside
the loop, so reading the history of several observations at once (the
latest-observation list, an export) gave every row the history of all
their types together. The domain also compared type_id with a list
using "=", which Odoo 17 and later log as a warning. Use rec and "in".

Refs: nirun-life#181

@piruin piruin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@piruin
piruin merged commit 80841a4 into nirun-life:16.0 Oct 30, 2026
4 checks passed
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.

2 participants