[FIX] *: cls as first arg of class methods (C0202)
Part-of: odoo/odoo#86332
This commit is contained in:
@@ -8,31 +8,31 @@ from odoo.addons.stock.tests import common2
|
||||
class TestMrpCommon(common2.TestStockCommon):
|
||||
|
||||
@classmethod
|
||||
def generate_mo(self, tracking_final='none', tracking_base_1='none', tracking_base_2='none', qty_final=5, qty_base_1=4, qty_base_2=1, picking_type_id=False, consumption=False):
|
||||
def generate_mo(cls, tracking_final='none', tracking_base_1='none', tracking_base_2='none', qty_final=5, qty_base_1=4, qty_base_2=1, picking_type_id=False, consumption=False):
|
||||
""" This function generate a manufacturing order with one final
|
||||
product and two consumed product. Arguments allows to choose
|
||||
the tracking/qty for each different products. It returns the
|
||||
MO, used bom and the tree products.
|
||||
"""
|
||||
product_to_build = self.env['product.product'].create({
|
||||
product_to_build = cls.env['product.product'].create({
|
||||
'name': 'Young Tom',
|
||||
'type': 'product',
|
||||
'tracking': tracking_final,
|
||||
})
|
||||
product_to_use_1 = self.env['product.product'].create({
|
||||
product_to_use_1 = cls.env['product.product'].create({
|
||||
'name': 'Botox',
|
||||
'type': 'product',
|
||||
'tracking': tracking_base_1,
|
||||
})
|
||||
product_to_use_2 = self.env['product.product'].create({
|
||||
product_to_use_2 = cls.env['product.product'].create({
|
||||
'name': 'Old Tom',
|
||||
'type': 'product',
|
||||
'tracking': tracking_base_2,
|
||||
})
|
||||
bom_1 = self.env['mrp.bom'].create({
|
||||
bom_1 = cls.env['mrp.bom'].create({
|
||||
'product_id': product_to_build.id,
|
||||
'product_tmpl_id': product_to_build.product_tmpl_id.id,
|
||||
'product_uom_id': self.uom_unit.id,
|
||||
'product_uom_id': cls.uom_unit.id,
|
||||
'product_qty': 1.0,
|
||||
'type': 'normal',
|
||||
'consumption': consumption if consumption else 'flexible',
|
||||
@@ -40,7 +40,7 @@ class TestMrpCommon(common2.TestStockCommon):
|
||||
(0, 0, {'product_id': product_to_use_2.id, 'product_qty': qty_base_2}),
|
||||
(0, 0, {'product_id': product_to_use_1.id, 'product_qty': qty_base_1})
|
||||
]})
|
||||
mo_form = Form(self.env['mrp.production'])
|
||||
mo_form = Form(cls.env['mrp.production'])
|
||||
mo_form.product_id = product_to_build
|
||||
if picking_type_id:
|
||||
mo_form.picking_type_id = picking_type_id
|
||||
|
||||
Reference in New Issue
Block a user