1
0
forked from Mapan/odoo17e
odoo17e-kedaikipas58/addons/quality/tests/test_quality_check.py
2024-12-10 09:04:09 +07:00

37 lines
1.2 KiB
Python

# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tests.common import TransactionCase
from odoo.tests import Form
class TestQualityCheck(TransactionCase):
def test_change_quality_point(self):
"""
Test that a quality point can be used with an incompatible product.
"""
product_a = self.env['product.product'].create({
'name': 'product a',
'type': 'product'
})
product_b = self.env['product.product'].create({
'name': 'product b',
'type': 'product'
})
qp_product_a = self.env['quality.point'].create({
'product_ids': [(4, product_a.id)],
})
qp_product_b = self.env['quality.point'].create({
'product_ids': [(4, product_b.id)],
})
qc = self.env['quality.check'].create({
'product_id': product_b.id,
'point_id': qp_product_b.id,
'team_id': 1
})
qc_form = Form(qc)
qc_form.point_id = qp_product_a
qc = qc_form.save()
self.assertEqual(qc.product_id, product_b)
self.assertEqual(qc.point_id, qp_product_a)