[MIG] quality_control_stock_oca: Migration to 15.0

This commit is contained in:
David Alonso // Solvos
2023-02-17 16:46:32 +01:00
committed by Víctor Martínez
parent 1deca6ae89
commit bc72b08044
3 changed files with 10 additions and 28 deletions

View File

@@ -5,7 +5,7 @@
{
"name": "Quality control - Stock (OCA)",
"version": "14.0.1.0.1",
"version": "15.0.1.0.0",
"category": "Quality control",
"license": "AGPL-3",
"author": "OdooMRP team, AvanzOSC, Serv. Tecnol. Avanzados - Pedro M. Baeza, "

View File

@@ -63,7 +63,7 @@ class QcInspection(models.Model):
@api.depends("object_id")
def _compute_product_id(self):
"""Overriden for getting the product from a stock move."""
super()._compute_product_id()
res = super()._compute_product_id()
for inspection in self.filtered("object_id"):
if inspection.object_id._name == "stock.move":
inspection.product_id = inspection.object_id.product_id
@@ -71,6 +71,7 @@ class QcInspection(models.Model):
inspection.product_id = inspection.object_id.product_id
elif inspection.object_id._name == "stock.production.lot":
inspection.product_id = inspection.object_id.product_id
return res
@api.onchange("object_id")
def onchange_object_id(self):

View File

@@ -2,7 +2,7 @@
# Copyright 2018 Simone Rubino - Agile Business Group
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo.tests.common import TransactionCase
from odoo.tests.common import TransactionCase, new_test_user
class TestQualityControl(TransactionCase):
@@ -19,10 +19,6 @@ class TestQualityControl(TransactionCase):
self.test = self.env.ref("quality_control_oca.qc_test_1")
self.picking_type = self.env.ref("stock.picking_type_out")
self.location_dest = self.env.ref("stock.stock_location_customers")
self.group_stock_user = self.env.ref("stock.group_stock_user")
self.group_quality_control_user = self.env.ref(
"quality_control_oca.group_quality_control_user"
)
self.company = self.env.ref("base.main_company")
self.sequence = self.env["ir.sequence"].create(
{"code": "out", "name": "outgoing_sequence"}
@@ -41,11 +37,12 @@ class TestQualityControl(TransactionCase):
"company_id": self.company.id,
}
)
self.user1_id = self._create_user(
"user_1",
[self.group_stock_user, self.group_quality_control_user],
self.company,
)
self.user1_id = new_test_user(
self.env,
login="user_1",
groups="stock.group_stock_user,quality_control_oca.group_quality_control_user",
company_id=self.company.id,
).id
move_vals = {
"name": self.product.name,
"product_id": self.product.id,
@@ -94,22 +91,6 @@ class TestQualityControl(TransactionCase):
)
sequence += 10
def _create_user(self, login, groups, company):
"""Create a user."""
group_ids = [group.id for group in groups]
user = self.users_model.with_context({"no_reset_password": True}).create(
{
"name": "Sale User",
"login": login,
"password": "test",
"email": "test@yourcompany.com",
"company_id": company.id,
"company_ids": [(4, company.id)],
"groups_id": [(6, 0, group_ids)],
}
)
return user.id
def test_inspection_create_for_product(self):
self.product.qc_triggers = [
(0, 0, {"trigger": self.trigger.id, "test": self.test.id})