'Test availability of production order.'

def test_production_avialability(self):

    self.bom_3.bom_line_ids.filtered((lambda x: (x.product_id == self.product_5))).unlink()
    self.bom_3.bom_line_ids.filtered((lambda x: (x.product_id == self.product_4))).unlink()
    production_2 = self.env['mrp.production'].create({'name': 'MO-Test001', 'product_id': self.product_6.id, 'product_qty': 5.0, 'bom_id': self.bom_3.id, 'product_uom_id': self.product_6.uom_id.id})
    production_2.action_assign()
    self.assertEqual(production_2.availability, 'waiting', 'Production    order    should    be    availability    for    waiting    state')
    inventory_wizard = self.env['stock.change.product.qty'].create({'product_id': self.product_2.id, 'new_quantity': 2.0})
    inventory_wizard.change_product_qty()
    production_2.action_assign()
    self.assertEqual(production_2.availability, 'partially_available', 'Production    order    should    be    availability    for    partially    available    state')
    inventory_wizard = self.env['stock.change.product.qty'].create({'product_id': self.product_2.id, 'new_quantity': 5.0})
    inventory_wizard.change_product_qty()
    production_2.action_assign()
    self.assertEqual(production_2.availability, 'assigned', 'Production    order    should    be    availability    for    assigned    state')
