Files
manufacture/quality_control_oca/wizard/qc_test_wizard.py
ps-tubtim 8ddbf1664b [MIG] quality_control: Migration to 13.0 + renaming to quality_control_oca
Co-authored-by: Carlos Roca <carlos.roca@tecnativa.com>
Co-authored-by: ps-tubtim <pimolnats@ecosoft.co.th>
Co-authored-by: Pedro M. Baeza < pedro.baeza@tecnativa.com>
2021-10-01 12:06:25 +02:00

29 lines
1.1 KiB
Python

# Copyright 2010 NaN Projectes de Programari Lliure, S.L.
# Copyright 2014 Serv. Tec. Avanzados - Pedro M. Baeza
# Copyright 2014 Oihane Crucelaegui - AvanzOSC
# Copyright 2017 ForgeFlow S.L.
# Copyright 2017 Simone Rubino - Agile Business Group
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models
class QcInspectionSetTest(models.TransientModel):
"""This wizard is used to preset the test for a given
inspection. This will not only fill in the 'test' field, but will
also fill in all lines of the inspection with the corresponding lines of
the template.
"""
_name = "qc.inspection.set.test"
_description = "Set test for inspection"
test = fields.Many2one(comodel_name="qc.test", string="Test")
def action_create_test(self):
inspection = self.env["qc.inspection"].browse(self.env.context["active_id"])
inspection.test = self.test
inspection.inspection_lines.unlink()
inspection.inspection_lines = inspection._prepare_inspection_lines(self.test)
return True