OCA / server-ux

GNU Affero General Public License v3.0
158 stars 514 forks source link

New tier validation record create with origin tier validation has comment #900

Open wangyuhuiever opened 2 months ago

wangyuhuiever commented 2 months ago

Module

The name of the module that has a bug. base_tier_validation

Describe the bug

A clear and concise description of what the bug is. There has two tier validation models. A and B, and definition A model has comment, and validate_tier A model and create B model in this method. It will update A model's review_ids fields res_id to B model's id.

To Reproduce

Affected versions: 16.0 verify and maybe others

Steps to reproduce the behavior:

  1. add A model tier_definition and check has_comment.
  2. inherit A model's validate_tier model and insert create B model method.
  3. fill comment and confirm.

Expected behavior A model will see review_ids in approve state, but now disappear。after check tier.view record, the res_id change to B model id.

The affect code in tier_validation.py -> _add_comment method, 'default_review_ids': reviews.ids. I fix this bug by override the context, create B model with_context({}), but I think this bug can be fixed by a more elegant way, so I submit this issue let you known.