Hi,
By default in Odoo Quality, a quality.check record
stays editable even after it has a result (Pass/Fail) or worksheet data.
Odoo doesn’t automatically lock them.
3 ways:
1. Security Group:
You can create a record rule that prevents write access on quality.check once certain conditions are met.
Example condition: only allow editing if quality_state = 'none' (not yet processed).
<record id="rule_quality_check_no_edit_done" model="ir.rule">
<field name="name">No edit on done quality checks</field>
<field name="model_id" ref="quality_control.model_quality_check"/>
<field name="groups" eval="[(4, ref('quality_control.group_quality_user'))]"/>
<field name="domain_force">[('quality_state', '!=', 'none')]</field>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="False"/>
<field name="perm_create" eval="True"/>
<field name="perm_unlink" eval="False"/>
</record>
Or
2. Python Code
Override the write method in a custom module, and raise an error if someone tries to edit a filled check:
from odoo import models, exceptions, _
class QualityCheck(models.Model):
_inherit = "quality.check"
def write(self, vals):
for rec in self:
if rec.quality_state != 'none': # already processed
raise exceptions.UserError(
_("You cannot modify a quality check once it has been filled.")
)
return super().write(vals)
Or
3. View Customization
You can make the form view read-only once filled by using a domain in Readonly:
<field name="quality_state" readonly="quality_state != 'none'"/>
Hope it helps.