1
0
forked from Mapan/odoo17e
odoo17e-kedaikipas58/addons/quality_iot/models/iot.py
2024-12-10 09:04:09 +07:00

18 lines
594 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models, api
class IotDevice(models.Model):
_inherit = 'iot.device'
qcp_test_type = fields.Char(compute='_compute_qcp_test_type')
quality_point_ids = fields.One2many('quality.point', 'device_id')
@api.depends('type')
def _compute_qcp_test_type(self):
types = {'device': 'measure', 'scale': 'measure', 'camera': 'picture', 'printer': 'print_label'}
for device in self:
device.qcp_test_type = types.get(device.type, '')